New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug involving escaped characters #2

Closed
sam0x17 opened this Issue Dec 2, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@sam0x17

sam0x17 commented Dec 2, 2018

It looks like it is currently not possible to escape control characters such as +, -, *,etc:

S = INTEGER;
INTEGER = SIGN_OP NUMBER | NUMBER;
NUMBER = "[0-9]+";
SIGN_OP = "\+" | "\-";

results in:

an error has occurred while compiling regular expressions: Invalid operator

Not sure why, but yes I have confirmed that the error is originating fromthe SIGN_OP = line.

btw, thx for everything

@sam0x17

This comment has been minimized.

sam0x17 commented Dec 2, 2018

update: I tried adding "+", "-", and "*" to the ESCAPES list, but this did not fix it

@DanilaFe

This comment has been minimized.

Owner

DanilaFe commented Dec 2, 2018

Thanks a lot for this issue. Two things come into play here:

  • The back slash needs to be escaped twice (once for the string, once for the regex), so \\+
  • I only allowed characters escapable in C++, which is blatantly wrong since it doesn't allow the regex control characters (they need to be added to the escape list like you described)

If my understanding of the problem is correct, I will be able to push the fix in about an hour.

@sam0x17

This comment has been minimized.

sam0x17 commented Dec 2, 2018

thanks!! yeah this reflects my suspicions

@DanilaFe

This comment has been minimized.

Owner

DanilaFe commented Dec 2, 2018

This should be fixed in 5cd399b. Thanks a lot for the report!

@sam0x17

This comment has been minimized.

sam0x17 commented Dec 2, 2018

👍 thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment