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:

  1. [\[] this worked in 4.5.3 but in 4.6 it’s an invalid escape sequence (instead [[] can be used)
  2. [\v] vertical tabs worked in 4.5.3 but they are invalid in 4.6
  3. In 4.5.3, arbitrary characters could be escaped like [\j\k\l] but now they are invalid.
  4. [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

Most upvoted comments

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 😃