Commit Graph

1903 Commits

Author SHA1 Message Date
Sam Harwell 0942edbedd Use LinkedHashMap for deterministic behavior in Graph class 2014-09-28 15:32:08 -05:00
Sam Harwell dd3eaaa31a Define a constant for the comments channel number 2014-09-28 15:03:14 -05:00
Sam Harwell 00227078e6 Move doc comments to comments channel (fixes #465) 2014-09-28 15:02:48 -05:00
Sam Harwell 88d46ee54b Cache the Java code generation templates 2014-09-28 13:08:48 -05:00
Sam Harwell cfb95ed95a Add missing Deprecated annotation (fixes build warning) 2014-09-28 13:08:21 -05:00
Sam Harwell 90071c69b8 Fix getSourceName returning null (fixes #667) 2014-09-28 12:12:15 -05:00
Sam Harwell 35bbdfb65c Allow XPath matching by literal or symbolic name (fixes #579) 2014-09-26 21:37:13 -05:00
Sam Harwell 0be4a3aaeb Fix test compile error by avoiding string literal assignments for the large lexer test 2014-09-26 21:37:12 -05:00
Sam Harwell d476d3e5d9 Implement token vocabulary (fixes #711) 2014-09-26 21:37:11 -05:00
Sam Harwell daa462206a Extract abstract model class Recognizer (parent of Parser and Lexer) 2014-09-26 17:34:30 -05:00
Terence Parr f143495ab2 Merge pull request #713 from sharwell/fix-707
Improved support for recursive imports
2014-09-26 14:40:36 -07:00
Terence Parr 0d18457c6d Merge pull request #716 from sharwell/fix-670
Add regression test for #670
2014-09-26 14:31:10 -07:00
Sam Harwell 3137672390 Add regression test for #670 2014-09-25 21:47:41 -05:00
Sam Harwell 4422e0ff12 Deprecate ALL_OPS_NEED_SAME_ASSOC (fixes #652) 2014-09-25 21:30:41 -05:00
Sam Harwell f78f6ceef0 Suppress OPTIONS_IN_DELEGATE warning if all options match the root grammar (fixes #707) 2014-09-25 21:18:55 -05:00
Sam Harwell 4b7873783d Remove logging code which has a detrimental performance impact on processing recursive imports 2014-09-25 21:18:54 -05:00
Sam Harwell e4c193005e Fix exponential complexity of recursive imports 2014-09-25 21:18:54 -05:00
Sam Harwell 9d6a6bd3a8 Add regression test for exponential complexity of recursive imports 2014-09-25 21:18:53 -05:00
Sam Harwell afadc2d976 Include initial value for attributes in generated code (fixes #672) 2014-09-19 17:05:20 -05:00
Terence Parr 6e581b3be6 Merge pull request #691 from sharwell/fix-688
Improved support for zero-length lexer tokens
2014-09-02 13:25:14 -07:00
Terence Parr a0584a2c31 token types bumped by 1 I assume due to recent lexer updates for 0-length tokens or for channel thing? 2014-09-01 13:25:30 -07:00
Terence Parr 7bf47e1670 Merge pull request #694 from sharwell/fix-309
Implement channels{} block
2014-09-01 12:56:57 -07:00
Sam Harwell 1f7220756a Place error 160 in the correct order in ErrorType.java 2014-09-01 13:29:12 -05:00
Sam Harwell cacd317d02 Implement support for defining custom channels in the channels{} construct in lexer grammars (fixes #309) 2014-09-01 13:28:08 -05:00
Sam Harwell e497efaa58 Support zero-length empty lexer rules with lexer commands (fixes #687) 2014-08-28 23:45:52 -05:00
Sam Harwell 6790b25e5b Support zero-length tokens in the lexer (fixes #688) 2014-08-28 23:45:07 -05:00
Sam Harwell 0c1178bf3a Include precedence in rule invocations when -atn is specified 2014-08-28 23:24:06 -05:00
Sam Harwell 99dd914045 Fix assignment of precedence for binary expressions with an implicit operator (e.g. testDuplicatedLeftRecursiveCall) 2014-08-28 23:23:26 -05:00
Sam Harwell a7f53ce396 Support list labels on the recursive atom in a left-recursive rule (fixes #677) 2014-08-09 11:07:15 -05:00
Sam Harwell 399a1df047 Add regression tests for #677 2014-08-09 10:55:20 -05:00
Sam Harwell 550a737acf Make sure code generation was successful before attempting to compile 2014-08-09 10:55:19 -05:00
Sam Harwell 8e69a5b99d Update CodeGenPipeline.process to check for errors before writing output files 2014-08-09 10:26:21 -05:00
Terence Parr 73d2f1f688 simplify; + node always points at loopback now. 2014-07-17 18:37:57 -07:00
Terence Parr aff865d1a7 Make the plus tree node point at loopback always. 2014-07-17 17:29:35 -07:00
Terence Parr 94c1c77652 If there is no loopentry decision, have + AST point to loopback 2014-07-16 20:59:39 -07:00
Terence Parr 2ca20e00ff Remove unneeded createATN(). 2014-07-16 20:37:15 -07:00
Terence Parr bb389782da Fixes #661. A parser rule reference within a lexer rule would get a bad error message and then an exception. Further, errors within the grammar tree visitor would go to standard error instead of to an error manager because none of the subclasses implemented getErrorManager(). Introduced an error type for this error PARSER_RULE_REF_IN_LEXER_RULE. Added to unit test. 2014-07-11 12:09:47 -07:00
Terence Parr 83411ef056 add test 2014-07-10 18:00:16 -07:00
Terence Parr 9b76e6423c refine error type 2014-07-05 19:08:31 -07:00
Terence Parr e1ba264d93 move common char encoding up to Target; same works for Python. 2014-07-03 10:54:49 -07:00
Terence Parr 07b7a4b334 I messed up the merge a bit in ErrorType. Made something into a grammar error not tool error. changed tool error back so it does not accept a token in the grammar. 2014-06-30 16:24:43 -07:00
Terence Parr d85ea0649a Merge branch 'err-msgs-upgrade'
Conflicts:
	tool/src/org/antlr/v4/tool/ErrorType.java
2014-06-30 15:59:19 -07:00
Terence Parr 1b7cdc4328 move templatesExist to Target 2014-06-30 15:38:15 -07:00
Terence Parr e3fc04bda1 put good quotes back in. rm unneeded arg to left-recur msg. 2014-06-30 15:16:20 -07:00
Terence Parr f1d782ffe1 Add convenience methods for detecting missing targets. At a few bail out points so that we don't try anything that will need code generator if we get an improper target. 2014-06-30 11:49:30 -07:00
Terence Parr f0ab9b1415 use assoc value's token. 2014-06-30 09:26:02 -07:00
Terence Parr 36425dd59c Big change to error messages themselves by removing single quotes for non input text stuff. Made cannot_find_tokens_file more specific (split it). Added offending token information to a lot of the messages. It now only prints the file name and not the full path to the file in error messages. Re-factored the ANTLRMessage hierarchy to share fields. Getting the offending token required number of methods to take different arguments. removed the default ST listener in the error manager as it is apparently unused. Cannot find imported grammar is now a grammar error not a tool error. 2014-06-29 21:39:15 -07:00
Terence Parr 4f7f8538ac add new panic() method, though not yet used. revert to java target if cannot find specified target 2014-06-29 13:02:34 -07:00
Terence Parr 2e352e2697 add unit tests for -o and -lib; improve BaseTest: refactor writeFile to Utils. -o options and others not accepted by antlr(). 2014-06-29 12:21:39 -05:00
Terence Parr a07d523c81 add comment 2014-06-29 09:43:24 -07:00
Sam Harwell 91206869c5 Prepare for next development iteration 2014-06-28 22:40:33 -05:00
Terence Parr 8937e0d16e repl space with tabs. 2014-06-28 14:56:47 -07:00
Terence Parr 4acb1091de refactor for reuse, make target check majorminor only. 2014-06-28 14:55:34 -07:00
Sam Harwell 7d88b0106a [maven-release-plugin] prepare for next development iteration 2014-06-18 21:25:44 -05:00
Sam Harwell 201eeb147d [maven-release-plugin] prepare release 4.3 2014-06-18 21:24:24 -05:00
Sam Harwell bbac283ba2 Add @since documentation to key new exposed API types/methods 2014-06-18 19:48:07 -05:00
Sam Harwell a72058bc67 Update dependency versions 2014-06-18 19:37:30 -05:00
Sam Harwell 3378be9c79 Update all version numbers for consistency prior to the 4.3 release 2014-06-18 19:37:29 -05:00
Sam Harwell 6949e832d9 Updated comments to clarify recent changes in code 2014-06-18 19:12:26 -05:00
Sam Harwell 7b88a6dbeb Update the assignment of Tool.VERSION (fixes #634)
* Reference RuntimeMetaData.VERSION so there are fewer version numbers to update during a release
* Assign the value in a static initializer so it's not a compile-time constant
2014-06-18 17:43:47 -05:00
Sam Harwell fab3a83107 Remove ability to reference enclosing rule by name, in favor of always using $ctx (fixes #571) 2014-06-16 18:06:09 -05:00
Terence Parr 91752af88d Merge pull request #623 from parrt/fix-set-subtract
getMinElement now supports values < 0.  Checked and shouldn't affect any...
2014-06-16 12:41:50 -07:00
Sam Harwell 2920ad0d1a * Updated documentation for IntSet
* Reimplemented IntervalSet.subtract and IntervalSet.complement to operate over the complete range of supported values
* Expanded several methods in IntervalSet to operate on any IntSet
* Mark COMPLETE_CHAR_SET and EMPTY_SET as read-only
2014-06-16 14:23:52 -05:00
Terence Parr 0575c59fc6 Merge pull request #629 from sharwell/fix-542
Consistent handling of element options applied to alternatives
2014-06-16 10:44:35 -07:00
Sam Harwell 6eeafacb88 Consistent handling of element options applied to alternatives (fixes #542) 2014-06-16 12:41:31 -05:00
Sam Harwell a812c32a22 Support multiple epsilon elements at the end of a left-recursive rule alternative (fixes #625) 2014-06-16 12:08:56 -05:00
Sam Harwell 9cbf473195 Add regression tests for #625 2014-06-16 12:08:56 -05:00
Terence Parr 51430018d0 getMinElement now supports values < 0. Checked and shouldn't affect any uses. subtract() from set with EOF, wiped out all negative values. added tests. 2014-06-14 13:14:32 -07:00
Terence Parr 633d4e2e19 Merge pull request #620 from sharwell/fix-543
Fix documentation comments generated for labeled alternatives
2014-06-10 16:45:21 -07:00
Terence Parr 662ef9bfac Merge pull request #619 from sharwell/sempred
Updated documentation and add argument validation assertion for SemPred
2014-06-10 16:44:23 -07:00
Terence Parr 63069a571d Merge pull request #618 from sharwell/fix-563
Fix cases where file encoding was not handled properly in the tool
2014-06-10 16:43:51 -07:00
Terence Parr 8abe81aaa6 Merge pull request #621 from parrt/token-names-vs-literals-fix
errors should display literal if no token name avail.
2014-06-10 16:37:33 -07:00
Sam Harwell 0c0fd67082 Merge pull request #616 from parrt/test-profiler-with-generated-code
test profiler with generated code. dump profile information using toStri...
2014-06-10 18:05:24 -05:00
Terence Parr a1c0319b41 test profiler with generated code. dump profile information using toString as dump() no longer available. 2014-06-10 18:04:12 -05:00
Terence Parr 0355f17f04 errors should display literal if no token name avail. 2014-06-10 15:47:28 -07:00
Sam Harwell 00f95b4a29 Fix documentation comments generated for labeled alternatives (fixes #543) 2014-06-10 17:34:04 -05:00
Sam Harwell 50cc4ac736 Updated documentation and add argument validation assertion for SemPred 2014-06-10 17:33:31 -05:00
Sam Harwell 156696be18 Fix cases where file encoding was not handled properly in the tool (fixes #563) 2014-06-10 17:32:59 -05:00
Terence Parr fdc46c53e6 Merge pull request #617 from sharwell/fix-588
Fix 588
2014-06-10 15:09:34 -07:00
Sam Harwell 9e7b13105d Fix optimizer incorrectly removing predicate transitions from the ATN (fixes #588) 2014-06-10 16:32:01 -05:00
Sam Harwell e4fa8f75d4 Add regression test for #588 2014-06-10 16:31:16 -05:00
Sam Harwell 58c1ad6cb8 Refactor shared load() method to BaseTest 2014-06-10 16:30:48 -05:00
Terence Parr 8447661a28 add unit test for issue 550 2014-06-10 12:10:01 -07:00
Terence Parr 358a1025d2 tweaks per Sam's comments. Just pushing straight to master. 2014-06-10 11:28:43 -07:00
ericvergnaud fa2ed459c6 Had lost some stuff 2014-06-07 00:57:13 +08:00
ericvergnaud fd9d707d95 tests granularity 2014-06-07 00:52:39 +08:00
ericvergnaud 0692334c9f unwanted format change 2014-06-07 00:13:38 +08:00
ericvergnaud bf83ee42bc Oops, removed some unwanted changes 2014-06-07 00:08:59 +08:00
ericvergnaud 00eb4f89ca Merge branch 'Improved-tests-granularity' into Preliminary-enhancements-for-Python-target 2014-06-07 00:01:13 +08:00
ericvergnaud 5778570faf warningw to be fixed separately 2014-06-06 23:54:52 +08:00
ericvergnaud 4545a8f5d0 resolved the Lexer listener/visitor issue by changing the tests grammar
using @members to @parser::members
2014-06-06 23:41:18 +08:00
ericvergnaud 33fd1804ff Merge branch 'Preliminary-enhancements-for-Python-target' into Improved-tests-granularity 2014-06-06 23:08:27 +08:00
ericvergnaud c46acf0031 cleanup after merge 2014-06-06 23:07:26 +08:00
ericvergnaud f75e15258f merged preliminary python enhancements 2014-06-06 23:02:50 +08:00
ericvergnaud 1592609e89 Improves the granularity of tests, thus helping narrow down differences
in behaviour between the reference Java target and other targets that
use the same test suite
2014-06-06 22:52:55 +08:00
ericvergnaud ff67ae5d19 Merge branch 'master' of https://github.com/antlr/antlr4 into Preliminary-enhancements-for-Python-target
Terence's implementation
2014-06-06 19:47:47 +08:00
Terence Parr 36da0daad7 no longer passing Parser/Lexer masquerading as superClass option. 2014-06-05 19:22:09 -07:00
ericvergnaud b8a91b9e3f Preliminary changes for Python 2014-06-06 03:13:09 +08:00
Terence Parr bc566605b1 Leave just one version spec in tool. Not looking externally anymore. 2014-06-04 17:23:47 -07:00
Terence Parr cc36281ce2 new definition of context sensitivity required change in test code. Updated profiler per Sam's comments. 2014-06-03 22:04:02 -07:00
Terence Parr 8d17f43f57 Merge pull request #601 from sharwell/versioning-docs
Versioning updates and documentation
2014-06-03 21:39:11 -07:00
Sam Harwell 80125d661e * Redefine checkVersion as version mismatch detection instead of a compatibility check
* Update notification behavior to notify callback listeners instead of throwing an exception
* Remove the distinction between regular and "extended" semantics
2014-06-03 18:31:52 -05:00
Sam Harwell 95596b4a52 Update ParserFactory.getLL1EBNFBlock to ensure it is correct even if additional ATN optimizations are implemented 2014-06-03 07:33:03 -05:00
Terence Parr 31a3b59576 Templates LL1PlusBlock and LL1StarBlock were not used. removed. added test for LL1OptionalBlock. 2014-06-03 07:33:00 -05:00
Sam Harwell e4e1cb1845 Updated the documentation and improved the flexibility for future use of RuntimeMetaData.checkVersion 2014-06-02 23:06:58 -05:00
Terence Parr 742429a15d make sure that previous tree node's start/stop token indexes are correct after left-recur elim. 2014-06-02 13:45:10 -05:00
Sam Harwell e7a1d84197 Fix support for element options on semantic predicates in left recursive rules (fixes #590) 2014-06-01 22:33:43 -05:00
Sam Harwell be16c71e56 Merge pull request #583 from sharwell/atn-profiler
Atn profiler
2014-06-01 22:30:39 -05:00
Terence Parr 68b186e77d Add utility methods and track token indexes through the left recursive rule transformation to allow external tools to associate ATN states and transitions with original locations in the grammar source file 2014-06-01 22:30:33 -05:00
Terence Parr e570489d33 Simplify common code in XPath tests 2014-06-01 22:29:35 -05:00
Terence Parr fb49d7c6a2 initial profiler 2014-06-01 22:15:12 -05:00
Sam Harwell 46e1bad7b4 Simplify the GrammarAST constructors, and correct the token start/stop index not being set 2014-05-31 18:14:41 -05:00
Terence Parr f3fcf5a712 Merge pull request #569 from parrt/runtime-tool-version-sync
add tool-template and generatedcode-runtime version compatibility check
2014-05-28 18:02:14 -07:00
Terence Parr 9e77e28bc1 should not be a default version lest all targets pass by default. make sure java target and tool move in lockstep. Fixes #572 2014-05-28 17:55:32 -07:00
Terence Parr 0b8a70a2a4 tweaks per Sam's comment. define default version so targets don't fail to compile. 2014-05-28 11:26:44 -07:00
Terence Parr db0830e00d To get static checking I converted the version template to a method and also moved the compatibility check into the target so that in the worst-case target developers can override the compatibility check per their needs. I have also decided to throw an exception for the Java target when the code generation and runtime library versions are incompatible. Change the tool message per Sam's request. 2014-05-28 11:14:00 -07:00
Sam Harwell 938a39c057 Qualify references to the ATN class to avoid symbol conflicts with tokens named ATN (fixes #561) 2014-05-24 16:49:38 -05:00
Sam Harwell e0937a6322 Add regression test for #561 (token named ATN breaks reference to ATN.INVALID_ALT_NUMBER) 2014-05-24 13:14:08 -05:00
Terence Parr 813fefdbb7 Fixes #554 2014-05-24 12:13:31 -05:00
Terence Parr 4aec5aeac2 add basic code generation testing rig and 1st test. 2014-05-24 12:10:47 -05:00
Terence Parr a3d4ba53a3 add tool-template and generatedcode-runtime version compatibility check. Target authors add a VERSION template and supply a RuntimeMetaData.checkVersion() method. 2014-05-19 17:25:01 -07:00
Sam Harwell 65b176a36d Return predefined values instead of null for Grammar methods getTokenNames, getTokenDisplayNames, and getRuleNames
Improve consistency of Grammar methods for names of rules and tokens
2014-04-13 18:46:28 -05:00
Sam Harwell 7e2bf4a2d5 [maven-release-plugin] prepare for next development iteration 2014-04-06 21:19:40 -05:00
Sam Harwell 736a5f5905 [maven-release-plugin] prepare release 4.2.2 2014-04-06 21:18:12 -05:00
Sam Harwell 88c7d09c24 Add unit tests for grammars with multiple EOF transitions 2014-04-06 16:23:57 -05:00
Terence Parr da9186ed63 Merge pull request #134 from parrt/eval-preds-when-delaying-errors
When delaying error reporting because prediction escapes the decision en...
2014-04-02 09:41:09 -07:00
Sam Harwell ea4676b18a adaptivePredict never returns -1; it could return ATN.INVALID_ALT_NUMBER 2014-04-01 21:26:48 -05:00
Sam Harwell 8c8d4d754e Remove incorrectly generated call to adaptivePredict
This particular call to adaptivePredict did not correctly match the decision number to the preceding setState() call. In addition, since this code is generated only for a positive closure, the only possible alternative is the one that enters the loop; error handling is deferred to the alternative(s) within the body of the closure.
2014-04-01 21:26:47 -05:00
Terence Parr 69d4b423e1 When delaying error reporting because prediction escapes the decision entry rule, we should evaluate predicates to turn off any configurations that are invalid semantically. After that, we can collect the list of alternatives that are satisfied with the input thus far and then choose the minimum as before. Fixes #529 2014-04-01 16:49:30 -07:00
Sam Harwell f34adc916a Added Grammar.undefineRule to support undefining rules prior to AST construction 2014-03-29 16:13:36 -05:00
Sam Harwell 5a56cc1147 Documented Grammar.defineRule, and updated it to return true if the rule was added to the Grammar 2014-03-29 16:13:35 -05:00
Sam Harwell 2729f176b2 Add option TestPerformance.REPORT_SECOND_STAGE_RETRY 2014-03-29 13:12:35 -05:00
Sam Harwell 5be18445cd [maven-release-plugin] prepare for next development iteration 2014-03-25 10:57:46 -05:00
Sam Harwell 943aaa5d24 [maven-release-plugin] prepare release 4.2.1 2014-03-25 10:57:44 -05:00
Sam Harwell d8efb4ad44 Updated build to use latest releases of ANTLR 3 and ST 4 2014-03-25 10:48:00 -05:00
Sam Harwell dcff40df90 Generate complete documentation with the Tool 2014-03-25 10:43:59 -05:00
Sam Harwell 85f09126e2 Don't include the annotation processor registration in the shaded (complete) jar 2014-03-24 20:43:55 -05:00
Sam Harwell 6642a9222d Merge pull request #516 from sharwell/fix-515
Fix usage of assoc=right in Java-LR.g4 (fixes #515)
2014-03-24 20:05:21 -05:00
Sam Harwell 014785b70a Fix usage of assoc=right in Java-LR.g4 (fixes #515) 2014-03-24 20:05:19 -05:00
Terence Parr b4b91970bd Merge pull request #495 from aphyr/fix-load-string-grammar-npe
BasicSemanticChecks.checkGrammarName: allow null filenames.
2014-03-24 13:20:54 -07:00
Sam Harwell ea088eb893 Add compile error 159: RESERVED_RULE_NAME (fixes #500) 2014-03-23 21:49:27 -05:00
Sam Harwell 0ed651cbc6 Add compiler warning 158: FRAGMENT_ACTION_IGNORED (fixes #472) 2014-03-23 18:02:09 -05:00
Sam Harwell 2b3ef648f8 Add compiler warning 157: UNRECOGNIZED_ASSOC_OPTION (fixes #489) 2014-03-23 17:47:40 -05:00
Sam Harwell 480544b4fe Improve wording in description of error 152 2014-03-23 16:31:46 -05:00
Sam Harwell 3e054df98b Do not process grammars following an error during parsing (fixes #507) 2014-03-23 16:31:14 -05:00
Sam Harwell 7daae3a89b Add compiler error 156: unterminated string literal (improves reporting for #507) 2014-03-23 16:30:49 -05:00
Terence Parr 794e4a0b7b Merge pull request #501 from sharwell/fix-433
Fix 433
2014-03-23 11:30:00 -07:00
Terence Parr e66f663618 Merge pull request #503 from sharwell/fix-469
Fix 469
2014-03-23 11:25:59 -07:00
Sam Harwell cb0119e761 Add regression test for issue #509 2014-03-23 11:34:36 -05:00
Sam Harwell 6fc77cd88d Add regression test for #469 2014-03-20 09:20:31 -05:00
Sam Harwell f1692591cc Updated RuleFunction.addContextGetters to support multiple alternatives with the same label (fixes #433) 2014-03-20 08:35:18 -05:00
Sam Harwell 3c70fea32a Add regression test for issue #433 2014-03-20 08:35:17 -05:00
Kyle Kingsbury a74005972d BasicSemanticChecks.checkGrammarName: allow null filenames.
checkGrammarName assumes that all grammars come from actual files, but
grammars loaded using Tool.parseGrammarFromString use input streams
without source file names. This patch changes checkGrammarName to only verify
that grammar names and file names correspond when a file name is
available.
2014-03-18 16:54:43 -07:00
Sam Harwell d498292680 Add regression test for issue #461 (interpreter starting with LR rule) 2014-02-06 20:46:32 -06:00
Sam Harwell 06ab99d16d [maven-release-plugin] prepare for next development iteration 2014-02-04 17:19:12 -06:00
Sam Harwell 5e05b71e8b [maven-release-plugin] prepare release 4.2 2014-02-04 17:19:11 -06:00
Sam Harwell 8ef0f590bb Updated build to include annotation processor in shaded Tool jar 2014-02-04 17:18:48 -06:00
Sam Harwell 2eb6f45bd9 Fix generated code Javadoc incompatible with Java 8 2014-01-26 11:49:20 -06:00
Sam Harwell e63f95268f Update javac options during testing to address overly verbose warnings 2014-01-23 07:25:41 -06:00
Sam Harwell 0f25d1c4cf Merge pull request #436 from sharwell/fix-test-output
Fix test failure due to change error message text
2014-01-21 19:18:53 -08:00
Sam Harwell ef5b6eb34e Fix test failure due to change error message text 2014-01-21 21:17:17 -06:00
Sam Harwell 608c6a8a3a Update several usages of @NotNull and @Nullable based on warnings from NullUsageProcessor 2014-01-21 21:08:11 -06:00
Sam Harwell b6f6c99c3c Updated documentation for ErrorType 2014-01-19 21:00:56 -06:00
Sam Harwell a55901bc0d We are working on the 4.2 release 2014-01-19 13:43:57 -06:00
Terence Parr 9b85e9c636 Merge pull request #426 from sharwell/fix-175
Support grammar files encoded with UTF-8 with a byte order mark
2014-01-17 10:22:47 -08:00
Sam Harwell 14107cc40a Add regression test for expression performance (closes #192) 2014-01-17 08:54:43 -06:00
Sam Harwell da0864a2f8 Support grammar files encoded with UTF-8 with a byte order mark (fixes #175) 2014-01-17 08:37:49 -06:00
Sam Harwell 664d66d937 Fix incorrect combineMax implementation (fixes #299) 2014-01-16 20:35:03 -06:00
Sam Harwell 9889de87ac Add regression test highlighting issue #299 2014-01-16 20:35:03 -06:00
Sam Harwell 85a923f61e Fix IndexOutOfBoundsException when using ANTLR with Java 8 (fixes #337) 2014-01-16 17:13:18 -06:00
Sam Harwell dbfb230b11 Cleaner output in TestPerformance when checksum calculation is disabled 2014-01-16 16:11:21 -06:00
Sam Harwell f2966aaa80 Improve support for m2e (Maven/Eclipse integration) (fixes #319) 2014-01-16 15:44:12 -06:00
Sam Harwell 4fc32e1f7c Fix options not getting properly applied to extracted lexer in combined grammar (fixes #372) 2014-01-16 10:34:55 -06:00
Sam Harwell 05b8c22833 Syntax errors while lexing stop grammar compilation process (fixes #308) 2014-01-15 21:39:19 -06:00
Sam Harwell 511c60fe7b Merge pull request #417 from sharwell/fix-370
Fix 370
2014-01-15 12:33:11 -08:00
Sam Harwell 83ad25ea1d Add regression test for #370 2014-01-15 14:31:41 -06:00
Terence Parr d0b8ccefdc set filename 2014-01-15 12:14:11 -08:00
Terence Parr 9f28fca583 split action/command tests from lexer tests; add tests for new action stuff from Sam. 2014-01-15 11:36:37 -08:00
Terence Parr 3c51f7ad7b Add tests for ungrammatical tree patterns. Fixes #413 2014-01-15 11:15:31 -08:00
Sam Harwell 5e9b869f1d Updated lexer to support encoding commands in the ATN and interpreting them with LexerInterpreter 2014-01-14 20:17:37 -06:00
Terence Parr d4275ab53a Range check; apparently string literal map not set when we create interp vs code gen. 2014-01-14 19:26:39 -06:00
Terence Parr bc4f3a72aa add helper methods and rename some internal Tool methods 2014-01-14 19:26:32 -06:00
Sam Harwell 967e74aa0d Pass the ATN through the ATNSerializer prior to creating an interpreter (fixes #403) 2014-01-13 20:17:04 -06:00
Sam Harwell 266f7276d1 Initial implementation of a "precedence DFA" (fixes #400) 2014-01-09 18:11:17 -06:00
Sam Harwell bf22a0af5b Add regression test for #398 2014-01-09 06:51:49 -06:00
Terence Parr 6b2817f8bb get last not first when get() finds multiple matching nodes. 2013-12-20 12:47:19 -08:00
Terence Parr 8c5d088eb7 Merge pull request #378 from sharwell/polish
Tree patterns polish
2013-12-19 17:24:42 -08:00
Sam Harwell fb1880d82c Move ATNSerializer to runtime 2013-12-19 19:07:24 -06:00
Sam Harwell bc59f30857 Use ATNDeserializer methods instead of deprecated ATNSimulator methods 2013-12-19 19:07:23 -06:00
Sam Harwell 2a9a716c53 Remove unnecessary methods ParseTreeMatch.getText() and failed() (use getTree().getText() and !succeeded() instead) 2013-12-19 19:06:22 -06:00
Sam Harwell 72675075cf Remove unnecessary testing constructor 2013-12-19 19:06:21 -06:00
Sam Harwell 75b8174dc8 Clean up the result caching for getTokenTypeMap and getRuleIndexMap 2013-12-19 19:06:20 -06:00
Sam Harwell df61690758 Clean up the caching of ATN instances with bypass alternatives 2013-12-19 19:06:19 -06:00
Terence Parr 9ca6bf9bd3 fix null pointer bug with rule "a : a;" 2013-12-19 16:35:37 -08:00
Terence Parr bd91dc166d add getTokenTypeMap(), getRuleIndexMap() to recognizer. Gen new fields for that an ATN with bypass alts. Then methods for that: getATNWithBypassAlts(). Big changes to interface for ParseTreeMatch; create Parser.compileParseTreePattern() method. Convert rule names to rule indexes. 2013-11-24 14:04:46 -08:00
Terence Parr 4c52a103e1 cleanup 2013-11-22 11:31:59 -08:00
Terence Parr b2ec85d14d updated comments, cleaned up the API, made helper routines. 2013-11-22 11:08:16 -08:00
Terence Parr 168bce79d3 working on api 2013-11-22 09:55:40 -08:00
Terence Parr 4fdd520c2e got labels working 2013-11-21 16:01:02 -08:00
Terence Parr 1e83557819 reorg to pass round a match object in matches_() 2013-11-21 10:30:37 -08:00
Terence Parr e836544d30 add test for hidden tokens 2013-11-21 09:55:26 -08:00
Terence Parr e68757717f pass a lexer and a parser to the tree pattern match or instead of the classes. 2013-11-21 09:32:45 -08:00
Terence Parr 33d11709df Revert "fix comment"
This reverts commit e8f577e162.
2013-11-21 08:42:28 -08:00
Terence Parr e8f577e162 fix comment 2013-11-21 08:42:02 -08:00
Terence Parr 40789babf5 got tree pattern matching working on my test cases using a parser interpreter not been generated parser to compile patterns like "<ID> = <expr>;". It uses Sam's alteration to the ATN to have bypass alternatives for <expr> tags. 2013-11-20 17:54:57 -08:00
Terence Parr 2394b38995 added state to be consistent with enterRule(); most importantly, we need to set the state when we enter a recursive rule, which we are not doing at the moment. This was not a problem before because we never could directly call a recursive rule and the outer rule set the current state. Now that we are using recursive rules as start rules, we need to set the state. 2013-11-20 17:53:51 -08:00
Terence Parr 2791dd5619 Merge branch 'master' into tree-patterns 2013-11-20 16:57:16 -08:00
Terence Parr 8c57233db7 mv to runtime. damn git! 2013-11-20 16:53:49 -08:00
Terence Parr 1c71d05074 Merge branch 'master' into tree-patterns 2013-11-20 16:49:27 -08:00
Terence Parr cc07f8faec mv to runtime. was ref'ing v3 not v4 Token. 2013-11-20 16:47:17 -08:00
Terence Parr 578dcd0799 reformat 2013-11-20 16:36:34 -08:00
Terence Parr c7e9a410e9 rm unused field _contextStack 2013-11-20 16:35:55 -08:00
Terence Parr 48ce1f1809 Support getting the serialized ATN from a recognizer 2013-11-20 16:22:01 -08:00
Terence Parr d09510a936 Merge branch 'master' into tree-patterns 2013-11-20 16:09:36 -08:00
Terence Parr 41d9d5bfd4 Merge pull request #357 from sharwell/atn-deserializer
ATN deserializer
2013-11-20 14:33:07 -08:00
Terence Parr 42e5343287 Merge branch 'master' into tree-patterns 2013-11-20 14:31:08 -08:00
Terence Parr 5a6709aba6 update changes file, tweak parser interp test to use new api 2013-11-20 14:28:51 -08:00
Terence Parr 02f937b115 Merge branch 'master' into tree-patterns 2013-11-20 14:20:09 -08:00
Sam Harwell b447256f20 Extract ATN deserialization to a new class ATNDeserializer 2013-11-20 09:14:18 -06:00
Sam Harwell 6eb8111756 Generate method stub so external calls directly to LR rules do not require the precedence argument 2013-11-15 16:15:34 -06:00
Terence Parr 8cace4e182 pull master BaseTest 2013-11-14 14:47:49 -08:00
Terence Parr 2f902da3d2 pull master into branch 2013-11-14 14:43:50 -08:00
Sam Harwell 3309c9d85e Fix build warnings 2013-11-14 15:36:01 -06:00
Terence Parr 52981a1d97 Merge pull request #353 from sharwell/parser-interpreter
Parser interpreter
2013-11-14 12:06:45 -08:00
Terence Parr ab931e4449 Merge pull request #97 from sharwell/precedence-predicates
Precedence predicates
2013-11-14 11:54:55 -08:00
Sam Harwell 320fada3e3 When building trees in TestPerformance, compute checksum after the parse using ParseTreeWalker 2013-11-14 13:42:39 -06:00
Sam Harwell 49970a46b0 Improved handling of parse listeners in TestPerformance 2013-11-14 13:42:39 -06:00
Sam Harwell 33043d68c2 Add the USE_PARSER_INTERPRETER flag to TestPerformance 2013-11-14 13:42:38 -06:00
Sam Harwell f6024aae0a Updated interpreter APIs
* Add Grammar.createLexerInterpreter and Grammar.createParserInterpreter
* Rewrite LexerInterpreter to extend Lexer (greatly simplified)
2013-11-14 13:42:38 -06:00
Sam Harwell 508817a706 Fully quality type names from ANTLR 3 2013-11-14 13:42:37 -06:00
Sam Harwell 7165a42d21 Make sure to send the final exit rule event in ParserInterpreter 2013-11-14 13:42:37 -06:00
Sam Harwell e02968f0e7 Fix set and range transitions not matching input in ParserInterpreter 2013-11-14 13:42:36 -06:00
Sam Harwell b2a4bb91a7 Add ParserInterpreter implementation 2013-11-14 13:42:36 -06:00
Terence Parr a3d71db1bc Merge pull request #352 from parrt/xpath
Add XPath to collect parse tree nodes/subtrees.
2013-11-13 16:22:37 -08:00
Sam Harwell b14ca56441 Merge branch 'master' into precedence-predicates 2013-10-10 20:36:38 -05:00
Sam Harwell b80ad5052d Add regression test for issue #334 (already passes) 2013-09-30 22:35:03 -05:00
Terence Parr 8aeb90ef82 mv findAll to XPath; rm old test in playground. 2013-09-16 14:56:35 -07:00
Terence Parr 76633525bf rm comments 2013-09-16 14:50:28 -07:00
Terence Parr 01082414c3 rebuilt XPath using ANTLR itself; added error handling; added ! operator 2013-09-13 13:53:42 -07:00
Terence Parr 09ddded3ed cleaned up test rig. more tests. fix bugs. 2013-09-11 17:49:25 -07:00
Terence Parr 088cd4a9bc got test rig start. added support test rig stuff to exec parser. add findAll to ParseTree interface. 2013-09-11 14:59:53 -07:00
Terence Parr 3fda64f85b got a draft implementation 2013-09-11 11:25:07 -07:00
Terence Parr 8237952cbb stash 2013-09-10 20:11:01 -07:00
Terence Parr 913cda0721 adding more xpath expr types 2013-09-10 19:48:36 -07:00
Terence Parr d2caae46a7 working on xpath 2013-09-10 14:55:40 -07:00
Terence Parr 4055c24171 add comment 2013-09-09 17:30:04 -07:00
Terence Parr 76b4eef60a more unit tests; add <.> 2013-09-09 17:26:16 -07:00
Terence Parr 6a26f0499f a new test 2013-09-09 15:17:27 -07:00
Terence Parr 95aa103dc2 matches text now if not <ID> node 2013-09-09 15:13:37 -07:00
Terence Parr f995e47443 rm ruletag from ParserRuleContext; back to (expr <expr>) for tag in pattern 2013-09-09 14:54:44 -07:00
Terence Parr 90187039f0 foo 2013-09-09 14:45:46 -07:00
Terence Parr 0df4411ea7 got optimized tree back with <expr> as single node 2013-09-09 13:50:33 -07:00
Terence Parr cfac804b57 fix error handling to just match <expr> as token under expr RuleNode 2013-09-08 18:56:07 -07:00
Terence Parr 754348605d create match object for matching 2013-09-05 16:58:37 -07:00
Terence Parr 35e279cef1 change name from T.g4 to X.g4 to avoid weird classloader issue. TLexer lives somewhere in my damn system and I can't find it. 2013-09-05 10:35:20 -07:00
Terence Parr d2f7ba8339 cleanup 2013-09-04 17:25:14 -07:00
Terence Parr 4b87f84b99 got decent test rig 2013-09-04 17:09:14 -07:00
Terence Parr 531c31861a got basic pattern compilation going 2013-09-04 14:48:21 -07:00
Terence Parr 2aade3eecc avoid resource leak and cleanup (Coverity) 2013-08-31 17:46:23 -07:00
Terence Parr fc2dfcda96 dodgy code cleanup (Coverity) 2013-08-31 17:36:16 -07:00
Terence Parr 3e53c0c61d oops; deleted side-effecting "dead code" 2013-08-31 17:05:48 -07:00
Terence Parr 78298bb382 defined compareTo but not equals/hash (Coverity) 2013-08-31 16:56:07 -07:00
Terence Parr 875fa0a31d rm dead code (Coverity) 2013-08-31 16:52:07 -07:00
Terence Parr 8bff26d758 fix cut-paste error (Coverity) 2013-08-31 16:47:33 -07:00
Terence Parr 21248a42ca rm unneeded null ptr check (Coverity) 2013-08-31 16:37:16 -07:00
Terence Parr 1febc36e15 avoid potential null ptr deref (Coverity) 2013-08-31 16:32:59 -07:00
Terence Parr 0ac47437bc rm potential null ptr deref (Coverity) 2013-08-31 16:20:34 -07:00
Terence Parr 9c186c8d52 rm print statement 2013-08-31 12:20:57 -07:00
Sam Harwell 04d2b5b92d Add regression test for #315 (already passes) 2013-08-12 19:26:40 -05:00
Terence Parr 19fce5dd7d change ruleElementOption back to elementOption 2013-08-08 16:12:01 -07:00
Terence Parr 531afe5af8 changed grammar to allow <assoc=right> on | operator for alt. still allowed on token refs but ignored. Simplified left-recursion elemination rules. see CHANGES.TXT Aug 7, 2013. BREAKING CHANGE. Must alter ternary op alts in grammars. 2013-08-08 17:06:15 -05:00
Terence Parr 185ee4e18e add <options> notation to alt right after pipe. rename elementOption to ruleElementOption as it now can match options on alt. Move AltAST to have options. 2013-08-08 17:06:15 -05:00
Terence Parr d041a4828a fix poor function name: setTokenAssoc 2013-08-08 17:05:19 -05:00
Sam Harwell 274120c2b6 Now working on release 4.1.1 2013-07-02 19:11:04 -05:00
Sam Harwell 6236072e3b Documentation updates prior to release 2013-06-30 15:50:56 -05:00
Sam Harwell dbe1390c6f Update referenced maven plugin version numbers 2013-06-30 12:47:26 -05:00
Sam Harwell 05f7fc6500 Update development version to 4.1 (from 4.0.1) 2013-06-30 12:46:41 -05:00
Terence Parr b7133164f4 Merge pull request #294 from sharwell/fix-293
Remove tool/playground from source control, add to .gitignore
2013-06-29 11:58:42 -07:00
Sam Harwell 36acb139b7 Remove the SET_QUALIFIED_ATTR rule from ActionSplitter since it provides no additional functionality (fixes #295) 2013-06-28 10:28:55 -05:00
Sam Harwell 931df811db Remove tool/playground from source control, add to .gitignore (fixes #293) 2013-06-25 14:30:25 -05:00
Sam Harwell b0ddb45654 Merge pull request #284 from sharwell/epsilon-analysis
Add the EPSILON_CLOSURE error and EPSILON_OPTIONAL warning
2013-06-24 13:09:38 -07:00
Sam Harwell 82330a8a78 Support Unicode escape sequences in JavaUnicodeInputStream with indirection (multiple 'u' characters) (fixes #287) 2013-06-24 12:02:42 -05:00
Sam Harwell 40f41e2b1c Fix ATN created for non-greedy optional block with multiple alternatives 2013-06-14 21:05:58 -05:00
Sam Harwell 3bb774a508 Add the EPSILON_CLOSURE error and EPSILON_OPTIONAL warning 2013-06-14 20:53:34 -05:00
Sam Harwell cd73c212fb Add regression test for #239 2013-06-09 14:11:35 -05:00
Sam Harwell 6fe7154c44 Exclusive or operator is left associative (fixes #280) 2013-06-08 21:09:33 -05:00
Sam Harwell ba532cdd49 Support list labels on a set of tokens (fixes #270) 2013-06-08 11:59:47 -05:00
Sam Harwell 2a90413188 Use standard 0-based indexing 2013-06-01 22:07:27 -05:00
Sam Harwell 9167968b74 Only serialize unique sets (smaller serialized ATN) 2013-06-01 22:03:31 -05:00
Sam Harwell dc801ad6a7 Extend the supported input character range to include all UTF-16 code points (specifically, U+FFFF is now supported, fixes #267) 2013-06-01 22:03:18 -05:00
Sam Harwell f1f134c962 DiagnosticErrorListener includes rule names for each decision in its reports 2013-06-01 21:55:31 -05:00
Sam Harwell 2f2fd4585e Improved error message for unterminated string literals (fixes #243) 2013-05-26 13:45:38 -05:00
Sam Harwell d3af4a2f3a Report errors that occur while lexing a grammar (fixes #262) 2013-05-26 13:45:38 -05:00
Sam Harwell 611e5ebf02 Significantly improve the performance of JavaUnicodeInputStream.LA(1) 2013-05-24 09:40:48 -05:00
Sam Harwell 469ebdd6e8 Fix unit tests now that the parser might not compute the conflicting alts BitSet before calling report methods 2013-05-20 14:58:32 -05:00
Sam Harwell 13f121a16f Add @NotNull annotations to listener and visitor methods 2013-05-20 14:20:54 -05:00
Sam Harwell d6c3841b0a Generate Javadoc for the generated listener and visitor interfaces, classes, and methods 2013-05-20 14:19:53 -05:00
Sam Harwell f6255bd5be Add regression test for #248 (already passes) 2013-05-20 13:31:47 -05:00
Sam Harwell ec8457383c Calculate detailed transition statistics per decision 2013-05-18 14:22:09 -05:00
Sam Harwell d8f2a5ce3c Pass more information to ANTLRErrorListener methods 2013-05-18 14:17:36 -05:00