Skip to content

Releases: antlr/antlr4

4.1

23 Jul 00:46
Compare
Choose a tag to compare
4.1

Feature and Bug Fix Release (minor breaking changes)

You can view all issues closed for this release here, and all commits for this release here.

New Features

This list may be incomplete, and does not include ordinary bug fixes.

  • Additional static analysis to report warnings and errors in grammars.
  • Improved support for other targets (currently Java and C# targets are available).
  • Added parse tree JTree pane and Export to PNG feature to parse tree viewer.
  • Improved runtime API documentation.
  • Improved parsing performance.
  • Support \uFFFF in lexers.
  • Updated Java grammars to support Java 7 syntax, including full support for Unicode escape sequences.

Breaking Changes

This list may be incomplete

The following changes are likely to have a significant impact on user code.

  • The serialized ATN representation has changed and is not backwards compatible. All parsers must be regenerated before they can be used with the ANTLR 4.1 runtime.

The following changes are not likely to break user code (infrequently used features or code).

  • Changed the formatting of the default error messages printed to console (could affect tools which parse this raw output).
  • Remove the ParserRuleContext.altNum field.
  • String literals and lexer character sets cannot span multiple lines in the grammar. Use the escape characters \n and/or \r to include newline characters in a literal or set.
  • The Pair and Triple classes in the runtime are now immutable, and Triple does not extend Pair.
  • If you extended the ANTLRErrorStrategy interface (or one of its derived classes), be aware of significant changes to those files.
  • If you extended LexerATNSimulator or ParserATNSimulator, be aware of significant changes in those classes.
  • Removed ParserInterpreter.predictATN.
  • If you use code to clear the cached DFA, be aware that the invariants have changed and the previous code will result in an exception with ANTLR 4.1.
    • Old method (ANTLR 4.0)

        Arrays.fill(parser.getInterpreter().decisionToDFA, null);
      
    • New method (ANTLR 4.1)

        ATN atn = parser.getATN();
        for (int i = 0; i < parser.getInterpreter().decisionToDFA.length; i++) {
            parser.getInterpreter().decisionToDFA[i] = new DFA(atn.getDecisionState(i), i);
        }