CHANGES.txt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. ****************************************************************************
  2. As of ANTLR 4.2.1, March 25 2014, we are no longer updating this file. Instead,
  3. we are using the github release mechanism. For example, here is
  4. 4.2.1 release notes:
  5. https://github.com/antlr/antlr4/releases/tag/4.2.1
  6. ****************************************************************************
  7. ANTLR v4 Honey Badger
  8. January 15, 2014
  9. * Unit tests for lexer actions from yesterday.
  10. * Refactored TreeView so we can refresh tree externally w/o creating new one.
  11. Needed for intellij plugin.
  12. January 14, 2014
  13. * Updated serialized ATN representation of lexer actions, allowing the lexer
  14. interpreter to execute the majority of lexer commands (#408)
  15. January 12, 2014
  16. * Support executing precedence predicates during the SLL phase of
  17. adaptivePredict (#401). The result is a massive performance boost for grammars
  18. containing direct left-recursion (improvements of 5% to 1000+% have been
  19. observed, depending on the grammar and input).
  20. December 29, 2013
  21. * Internal change: Tool.loadGrammar() -> parseGrammar(). Tool.load()->parse()
  22. * Added Tool.loadGrammar(fileName) that completely parses, extracts implicit lexer,
  23. and processes into Grammar object. Does not geneate code. Use
  24. Grammar.getImplicitLexer() to get the lexer created during processing of
  25. combined grammar.
  26. * Added Grammar.load(fileName) that creates Tool object for you. loadGrammar()
  27. lets you create your own Tool for setting error handlers etc...
  28. final Grammar g = Grammar.load("/tmp/MyGrammar.g4");
  29. December 19, 2013
  30. * Sam:
  31. Improved documentation for tree patterns classes
  32. Refactored parts of the tree patterns API to simplify classes and improve encapsulation
  33. Move ATN serializer to runtime
  34. Use ATNDeserializer methods instead of ATNSimulator methods which are now deprecated
  35. * parrt: fix null pointer bug with rule "a : a;"
  36. November 24, 2013
  37. * Ter adds tree pattern matching. Preferred interface:
  38. ParseTree t = parser.expr();
  39. ParseTreePattern p = parser.compileParseTreePattern("<ID>+0", MyParser.RULE_expr);
  40. ParseTreeMatch m = p.match(t);
  41. String id = m.get("ID");
  42. or
  43. String xpath = "//blockStatement/*";
  44. String treePattern = "int <Identifier> = <expression>;";
  45. ParseTreePattern p =
  46. parser.compileParseTreePattern(treePattern,
  47. JavaParser.RULE_localVariableDeclarationStatement);
  48. List<ParseTreeMatch> matches = p.findAll(tree, xpath);
  49. November 20, 2013
  50. * Sam added method stuff like expr() that calls expr(0). Makes it possible
  51. to call expr rule from TestRig (grun).
  52. November 14, 2013
  53. * Added Sam's ParserInterpreter implementation that uses ATN after
  54. deserialization.
  55. LexerGrammar lg = new LexerGrammar(
  56. "lexer grammar L;\n" +
  57. "A : 'a' ;\n" +
  58. "B : 'b' ;\n" +
  59. "C : 'c' ;\n");
  60. Grammar g = new Grammar(
  61. "parser grammar T;\n" +
  62. "s : (A{;}|B)* C ;\n",
  63. lg);
  64. LexerInterpreter lexEngine = lg.createLexerInterpreter(new ANTLRInputStream(input));
  65. CommonTokenStream tokens = new CommonTokenStream(lexEngine);
  66. ParserInterpreter parser = g.createParserInterpreter(tokens);
  67. ParseTree t = parser.parse(g.rules.get(startRule).index);
  68. November 13, 2013
  69. * move getChildren() from Tree into Trees (to avoid breaking change)
  70. * Notation:
  71. /prog/func, -> all funcs under prog at root
  72. /prog/*, -> all children of prog at root
  73. /*/func, -> all func kids of any root node
  74. prog, -> prog must be root node
  75. /prog, -> prog must be root node
  76. /*, -> any root
  77. *, -> any root
  78. //ID, -> any ID in tree
  79. //expr/primary/ID, -> any ID child of a primary under any expr
  80. //body//ID, -> any ID under a body
  81. //'return', -> any 'return' literal in tree
  82. //primary/*, -> all kids of any primary
  83. //func/*/stat, -> all stat nodes grandkids of any func node
  84. /prog/func/'def', -> all def literal kids of func kid of prog
  85. //stat/';', -> all ';' under any stat node
  86. //expr/primary/!ID, -> anything but ID under primary under any expr node
  87. //expr/!primary, -> anything but primary under any expr node
  88. //!*, -> nothing anywhere
  89. /!*, -> nothing at root
  90. September 16, 2013
  91. * Updated build.xml to support v4 grammars in v4 itself; compiles XPathLexer.g4
  92. * Add to XPath:
  93. Collection<ParseTree> findAll(String xpath);
  94. September 11, 2013
  95. * Add ! operator to XPath
  96. * Use ANTLR v4 XPathLexer.g4 not regex
  97. * Copy lots of find node stuff from v3 GrammarAST to Trees class in runtime.
  98. September 10, 2013
  99. * Adding in XPath stuff.
  100. August 31, 2013
  101. * Lots of little fixes thanks to Coverity Scan
  102. August 7, 2013
  103. * [BREAKING CHANGE] Altered left-recursion elimination to be simpler. Now,
  104. we use the following patterns:
  105. * Binary expressions are expressions which contain a recursive invocation of
  106. the rule as the first and last element of the alternative.
  107. * Suffix expressions contain a recursive invocation of the rule as the first
  108. element of the alternative, but not as the last element.
  109. * Prefix expressions contain a recursive invocation of the rule as the last
  110. element of the alternative, but not as the first element.
  111. There is no such thing as a "ternary" expression--they are just binary
  112. expressions in disguise.
  113. The right associativity specifiers no longer on the individual tokens because
  114. it's done on alternative basis anyway. The option is now on the individual
  115. alternative; e.g.,
  116. e : e '*' e
  117. | e '+' e
  118. |<assoc=right> e '?' e ':' e
  119. |<assoc=right> e '=' e
  120. | INT
  121. ;
  122. If your language uses a right-associative ternary operator, you will need
  123. to update your grammar to include <assoc=right> on the alternative operator.
  124. This also fixes #245 and fixes #268:
  125. https://github.com/antlr/antlr4/issues/245
  126. https://github.com/antlr/antlr4/issues/268
  127. To smooth the transition, <assoc=right> is still allowed on token references
  128. but it is ignored.
  129. June 30, 2013 -- 4.1 release
  130. June 24, 2013
  131. * Resize ANTLRInputStream.data after reading a file with fewer characters than
  132. bytes
  133. * Fix ATN created for non-greedy optional block with multiple alternatives
  134. * Support Unicode escape sequences with indirection in JavaUnicodeInputStream
  135. (fixes #287)
  136. * Remove the ParserRuleContext.altNum field (fixes #288)
  137. * PredictionContext no longer implements Iterable<SingletonPredictionContext>
  138. * PredictionContext no longer implements Comparable<PredictionContext>
  139. * Add the EPSILON_CLOSURE error and EPSILON_OPTIONAL warning
  140. * Optimized usage of closureBusy set (fixes #282)
  141. June 9, 2013
  142. * Add regression test for #239 (already passes)
  143. June 8, 2013
  144. * Support list labels on a set of tokens (fixes #270)
  145. * Fix associativity of XOR in Java LR grammar (fixes #280)
  146. June 1, 2013
  147. * DiagnosticErrorListener includes rule names for each decision in its reports
  148. * Document ANTLRErrorListener and DiagnosticErrorListener (fixes #265)
  149. * Support '\uFFFF' (fixes #267)
  150. * Optimize serialized ATN
  151. May 26, 2013
  152. * Report errors that occur while lexing a grammar (fixes #262)
  153. * Improved error message for unterminated string literals (fixes #243)
  154. May 24, 2013
  155. * Significantly improve performance of JavaUnicodeInputStream.LA(1)
  156. May 20, 2013
  157. * Generate Javadoc for generated visitor and listener interfaces and classes
  158. * Fix unit tests
  159. May 18, 2013
  160. * Group terminals in Java grammars so ATN can collapse sets
  161. * Improved Java 7 support in Java grammars (numeric literals)
  162. * Updated error listener interfaces
  163. * Support detailed statistics in TestPerformance
  164. May 17, 2013
  165. * Add JavaUnicodeInputStream to handle Unicode escapes in Java code
  166. * Proper Unicode identifier handling in Java grammars
  167. * Report file names with lexer errors in TestPerformance
  168. May 14, 2013
  169. * Use a called rule stack to prevent stack overflow in LL1Analyzer
  170. * Use 0-based indexing for several arrays in the tool
  171. * Code simplification, assertions, documentation
  172. May 13, 2013
  173. * Unit test updates to ensure exceptions are not hidden
  174. May 12, 2013
  175. * Updates to TestPerformance
  176. May 5, 2013
  177. * Updated several classes to use MurmurHash 3 hashing
  178. May 1, 2013
  179. * Added parse tree JTree to TreeViewer (Bart Kiers)
  180. April 30, 2013
  181. * Updated TestPerformance to support parallelization across passes
  182. April 24, 2013
  183. * Remove unused stub class ParserATNPathFinder
  184. * Remove ParserInterpreter.predictATN
  185. * Remove DFA.getATNStatesAlongPath
  186. * Encapsulate implementation methods in LexerATNSimulator and ParserATNSimulator
  187. * Updated documentation
  188. * Simplify creation of new DFA edges
  189. * Fix handling of previously cached error edges
  190. * Fix DFA created during forced-SLL parsing (PredictionMode.SLL)
  191. * Extract methods ParserATNSimulator.getExistingTargetState and
  192. ParserATNSimulator.computeTargetState.
  193. April 22, 2013
  194. * Lazy initialization of ParserATNSimulator.mergeCache
  195. * Improved hash code for DFAState
  196. * Improved hash code with caching for ATNConfigSet
  197. * Add new configuration parameters to TestPerformance
  198. * Update Java LR and Java Std to support Java 7 syntax
  199. April 21, 2013
  200. * Add new configuration parameters to TestPerformance
  201. April 18, 2013
  202. * Must check rule transition follow states before eliminating states in
  203. the ATN (fixes #224)
  204. * Simplify ParserATNSimulator and improve performance by combining execDFA and
  205. execATN and using DFA edges even after edge computation is required
  206. April 15, 2013
  207. * Fix code in TestPerformance that clears the DFA
  208. April 12, 2013
  209. * Improved initialization and concurrency control in DFA updates
  210. * Fix EOF handling in edge case (fixes #218)
  211. April 4, 2013
  212. * Improved testing of error reporting
  213. * Fix NPE revealed by updated testing method
  214. * Strict handling of redefined rules - prevents code generation (fixes #210)
  215. * Updated documentation in Tool
  216. March 27, 2013
  217. * Avoid creating empty action methods in lexer (fixes #202)
  218. * Split serialized ATN when it exceeds Java's 65535 byte limit (fixes #76)
  219. * Fix incorrect reports of label type conflicts across separated labeled outer
  220. alternatives (fixes #195)
  221. * Update Maven plugin site documentation
  222. March 26, 2013
  223. * Fix bugs with the closureBusy set in ParserATNSimulator.closure
  224. * Fix handling of empty options{} block (fixes #194)
  225. * Add error 149 INVALID_LEXER_COMMAND (fixes #190)
  226. * Add error 150 MISSING_LEXER_COMMAND_ARGUMENT
  227. * Add error 151 UNWANTED_LEXER_COMMAND_ARGUMENT
  228. * Updated documentation in the Parser and RecognitionException classes
  229. * Refactored and extensively documented the ANTLRErrorStrategy interface and
  230. DefaultErrorStrategy default implementation
  231. * Track the number of syntax errors in Parser.notifyErrorListeners instead of in
  232. the error strategy
  233. * Move primary implementation of getExpectedTokens to ATN, fixes #191
  234. * Updated ATN documentation
  235. * Use UUID instead of incremented integer for serialized ATN versioning
  236. March 7, 2013
  237. * Added export to PNG feature to the parse tree viewer
  238. March 6, 2013
  239. * Allow direct calls to left-recursive rules (fixes #161)
  240. * Change error type 146 (EPSILON_TOKEN) to a warning (fixes #180)
  241. * Specify locale for all format operations (fixes #158)
  242. * Fix generation of invalid Unicode escape sequences in Java code (fixes #164)
  243. * Do not require escape for $ in action when not followed by an ID start char
  244. (fixes #176)
  245. February 23, 2013
  246. * Refactoring Target-related classes to improve support for additional language
  247. targets
  248. February 22, 2013
  249. * Do not allow raw newline characters in literals
  250. * Pair and Triple are immutable; Triple is not a Pair
  251. February 5, 2013
  252. * Fix IntervalSet.add when multiple merges are required (fixes #153)
  253. January 29, 2013
  254. * don't call process() if args aren't specified (Dave Parfitt)
  255. January 21, 2013 -- Release 4.0
  256. * Updated PredictionContext Javadocs
  257. * Updated Maven site documentation
  258. * Minor tweaks in Java.stg
  259. January 15, 2013
  260. * Tweak error messages
  261. * (Tool) Make TokenVocabParser fields `protected final`
  262. * Fix generated escape sequences for literals containing backslashes
  263. January 14, 2013
  264. * Relax parser in favor of errors during semantic analysis
  265. * Add error 145: lexer mode must contain at least one non-fragment rule
  266. * Add error 146: non-fragment lexer rule can match the empty string
  267. January 11, 2013
  268. * Updated error 72, 76; added 73-74 and 136-143: detailed errors about name
  269. conflicts
  270. * Report exact location for parameter/retval/local name conflicts
  271. * Add error 144: multi-character literals are not allowed in lexer sets
  272. * Error 134 now only applies to rule references in lexer sets
  273. * Updated error messages (cleanup)
  274. * Reduce size of _serializedATN by adding 2 to each element: new representation
  275. avoids embedded values 0 and 0xFFFF which are common and have multi-byte
  276. representations in Java's modified UTF-8
  277. January 10, 2013
  278. * Add error 135: cannot assign a value to list label: $label
  279. (fixes antlr/antlr4#128)
  280. January 2, 2013
  281. * Fix EOF handling (antlr/antlr4#110)
  282. * Remove TREE_PARSER reference
  283. * Additional validation checks in ATN deserialization
  284. * Fix potential NPE in parser predicate evaluation
  285. * Fix termination condition detection in full-context parsing
  286. January 1, 2013
  287. * Updated documentation
  288. * Minor code cleanup
  289. * Added the `-XdbgSTWait` command line option for the Tool
  290. * Removed method override since bug was fixed in V3 runtime
  291. December 31, 2012
  292. * I altered Target.getTargetStringLiteralFromANTLRStringLiteral() so that
  293. it converts \uXXXX in an ANTLR string to \\uXXXX, thus, avoiding Java's
  294. conversion to a single character before compilation.
  295. December 16, 2012
  296. * Encapsulate some fields in ANTLRMessage
  297. * Remove ErrorType.INVALID
  298. * Update error/warning messages, show all v3 compatibility messages
  299. December 12, 2012
  300. * Use arrays instead of HashSet to save memory in SemanticContext.AND/OR
  301. * Use arrays instead of HashSet to save memory in cached DFA
  302. * Reduce single-operand SemanticContext.and/or operations
  303. December 11, 2012
  304. * Add -long-messages option; only show exceptions with errors when set
  305. * "warning treated as error" is a one-off error
  306. * Listen for issues reported by StringTemplate, report them as warnings
  307. * Fix template issues
  308. * GrammarASTWithOptions.getOptions never returns null
  309. * Use EnumSet instead of HashSet
  310. * Use new STGroup.GROUP_FILE_EXTENSION value
  311. December 2, 2012
  312. * Remove -Xverbose-dfa option
  313. * Create the ParseTreeVisitor interface for all visitors, rename previous base
  314. visitor class to AbstractParseTreeVisitor
  315. December 1, 2012
  316. * escape [\n\r\t] in lexical error messages; e.g,:
  317. line 2:3 token recognition error at: '\t'
  318. line 2:4 token recognition error at: '\n'
  319. * added error for bad sets in lexer; e.g.:
  320. lexer set element A is invalid (either rule ref or literal with > 1 char)
  321. some tests in TestSets appeared to allow ~('a'|B) but it was randomly working.
  322. ('a'|B) works, though doesn't collapse to a set.
  323. * label+='foo' wasn't generating good code. It was generating token type as
  324. variable name. Now, I gen "s<ttype>" for implicit labels on string literals.
  325. * tokens now have token and char source to draw from.
  326. * remove -Xsave-lexer option; log file as implicit lexer AST.
  327. November 30, 2012
  328. * Maven updates (cleanup, unification, and specify Java 6 bootstrap classpath)
  329. November 28, 2012
  330. * Maven updates (uber-jar, manifest details)
  331. November 27, 2012
  332. * Maven updates (prepare for deploying to Sonatype OSS)
  333. * Use efficient bitset tests instead of long chains of operator ==
  334. November 26, 2012
  335. * Maven updates (include sources and javadocs, fix warnings)
  336. * Don't generate action methods for lexer rules not containing an action
  337. * Generated action and sempred methods are private
  338. * Remove unused / problematic methods:
  339. ** (unused) TerminalNodeImpl.isErrorNode
  340. ** (unused) RuleContext.conflictsWith, RuleContext.suffix.
  341. ** (problematic) RuleContext.hashCode, RuleContext.equals.
  342. November 23, 2012
  343. * Updated Maven build (added master POM, cleaned up module POMs)
  344. November 22, 2012
  345. * make sure left-recur rule translation uses token stream from correct imported file.
  346. * actions like @after in imported rules caused inf loop.
  347. * This misidentified scope lexer/parser: @lexer::members { } @parser::members { }
  348. November 18, 2012
  349. * fixed: undefined rule refs caused exception
  350. * cleanup, rm dead etypes, add check for ids that cause code gen issues
  351. * added notion of one-off error
  352. * added check for v3 backward incompatibilities:
  353. ** tree grammars
  354. ** labels in lexer rules
  355. ** tokens {A;B;} syntax
  356. ** tokens {A='C';} syntax
  357. ** {...}?=> gate semantic predicates
  358. ** (...)=> syntactic predicates
  359. * Detect EOF in lexer rule
  360. November 17, 2012
  361. * .tokens files goes in output dir like parser file.
  362. * added check: action in lexer rules must be last element of outermost alt
  363. * properly check for grammar/filename difference
  364. * if labels, don't allow set collapse for
  365. a : A # X | B ;
  366. * wasn't checking soon enough for rule redef; now it sets a dead flag in
  367. AST so no more walking dup.
  368. error(51): T.g:7:0: rule s redefinition (ignoring); previous at line 3
  369. November 11, 2012
  370. * Change version to 4.0b4 (btw, forgot to push 4.0b3 in build.properties when
  371. I made git tag 4.0b3...ooops).
  372. November 4, 2012
  373. * Kill box in tree dialog box makes dialog dispose of itself
  374. October 29, 2012
  375. * Sam fixes nongreedy more.
  376. * -Werror added.
  377. * Sam made speed improvement re preds in lexer.
  378. October 20, 2012
  379. * Merged Sam's fix for nongreedy lexer/parser. lots of unit tests. A fix in
  380. prediction ctx merge. https://github.com/parrt/antlr4/pull/99
  381. October 14, 2012
  382. * Rebuild how ANTLR detects SLL conflict and failover to full LL. LL is
  383. a bit slower but correct now. Added ability to ask for exact ambiguity
  384. detection.
  385. October 8, 2012
  386. * Fixed a bug where labeling the alternatives of the start rule caused
  387. a null pointer exception.
  388. October 1, 2012 -- 4.0b2 release
  389. September 30, 2012
  390. * Fixed the unbuffered streams, which actually buffered everything
  391. up by mistake. tweaked a few comments.
  392. * Added a getter to IntStream for the token factory
  393. * Added -depend cmd-line option.
  394. September 29, 2012
  395. * no nongreedy or wildcard in parser.
  396. September 28, 2012
  397. * empty "tokens {}" is ok now.
  398. September 22, 2012
  399. * Rule exception handlers weren't passed to the generated code
  400. * $ruleattribute.foo weren't handled properly
  401. * Added -package option
  402. September 18, 2012 -- 4.0b1 release