antlr4: Escapes sequence recognition failure in character sets
After the 4.6 release, the behaviour of escape sequences in the lexer’s character sets changed compared to 4.5.3. I’m not sure whether they are bugs or features but I think it’s worth to mention:
[\[]
this worked in 4.5.3 but in 4.6 it’s an invalid escape sequence (instead[[]
can be used)[\v]
vertical tabs worked in 4.5.3 but they are invalid in 4.6- In 4.5.3, arbitrary characters could be escaped like
[\j\k\l]
but now they are invalid. [d-a]
: although its a bit weird, but was valid in 4.5.3, but it’s not in 4.6
If these changes are expected, then I’m going to create some PR-s in grammars-v4, since several of them are failing now.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 32 (27 by maintainers)
Commits related to this issue
- error-> warnings. Fixes #1537 — committed to parrt/antlr4 by parrt 7 years ago
- Merge pull request #1709 from parrt/fix-1537 error-> warnings. Fixes #1537 — committed to antlr/antlr4 by parrt 7 years ago
- we left invalid escapes in string literals which was causing an error. This is related to #1537. All tool errors pass now. — committed to parrt/antlr4 by parrt 7 years ago
Now ANTLR reports
error(156): Test.g4:8:16: invalid escape sequence \'
without crash because now it’s error instead of a warning (it’s fixed by https://github.com/antlr/antlr4/commit/7f07af85374383d877080fd97056977521056697). Now it’s eventually fixed I guess 😃