4.1
版本发布时间: 2013-07-23 08:46:49
antlr/antlr4最新发布版本:4.13.2(2024-08-04 03:28:03)
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
andTriple
classes in the runtime are now immutable, andTriple
does not extendPair
. - If you extended the
ANTLRErrorStrategy
interface (or one of its derived classes), be aware of significant changes to those files. - If you extended
LexerATNSimulator
orParserATNSimulator
, 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); }
-