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

issue with period "." character and regex #3

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

Comments

Projects
None yet
2 participants
@sam0x17

sam0x17 commented Dec 3, 2018

This has been giving me trouble as well:

S = FLOAT;
FLOAT = "[0-9]*.[0-9]+";
nojs$ echo '22.2' | pegasus-sim -i test.json
ParentTree(S)
  ParentTree(FLOAT)
    Token(1, 22.2)
(correct)
nojs$ echo '22.' | pegasus-sim -i test.json
ParentTree(S)
  ParentTree(FLOAT)
    Token(1, 22)
(shouldn't work because no ".")
nojs$ echo '.2' | pegasus-sim -i test.json
ParentTree(S)
  ParentTree(FLOAT)
    Token(1, .2)
(correct)

It's allowing a plain "2" to be a float, even though there is no ".". I'm pretty sure it's not my regex but something else going on with how the regex is parsed.

@DanilaFe

This comment has been minimized.

Owner

DanilaFe commented Dec 3, 2018

. is actually a reserved character in regular expressions that represents any character. It needs to be escaped to be used as a period character, and I just fixed the fact that it wasn't allowed to be escaped (similar to #2 )

@sam0x17

This comment has been minimized.

sam0x17 commented Dec 3, 2018

ah ok perfect that is why thanks!

@sam0x17 sam0x17 closed this Dec 3, 2018

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