Commit Graph

1161 Commits

Author SHA1 Message Date
Sam Harwell 7d4f71d829 Use IntegerList in the tool 2012-07-30 15:18:07 -05:00
Terence Parr 489f3d17cb tweak 2012-07-29 17:04:05 -07:00
Terence Parr 8836e13954 use ReentrantReadWriteLock to sync. works much better but still occasional illegal monitor state :( 2012-07-29 17:01:41 -07:00
Terence Parr 4fe9efeb85 tweak tester 2012-07-29 14:28:59 -07:00
Terence Parr c97f36bd89 reorg workers 2012-07-29 13:45:41 -07:00
Terence Parr 230b687b03 add barrier 2012-07-29 13:03:10 -07:00
Terence Parr 5712424156 create 2 worker threads for testjavalr 2012-07-29 12:28:29 -07:00
Terence Parr 7181483bbf test javalr does -2x now 2012-07-29 10:57:51 -07:00
Terence Parr 510c1c0dd9 clean up 2012-07-29 10:50:14 -07:00
Terence Parr 79594a942e synchronized lexer. just as fast now to build new parser/lexer each iter in TestJavaLR 2012-07-29 10:48:08 -07:00
Terence Parr e3e739dfc7 The lexer and parser ATN simulators' adaptivePredict now synchronize on the specific DFA of the decision to be simulated. This should prevent a lot of contention that would occur if we synchronize the entire adaptivePredict method. When the individual DFA are created, we also synchronize on the shared DFA[] table quickly to create a DFA and insert it into the array. Code generation modified to have _decisionToDFA generated at the top of both the parser and the lexer. Simulators created now with the recognizer, ATN, DFA[]. Not sure the LexerInterp/ParserInterp work but pushing ahead anyway for the moment. 2012-07-29 09:49:35 -07:00
Terence Parr 109880b7ab added ALIAS_REASSIGNMENT warning so redef of string literal among rules caught. First literal goes to .tokens. 2012-07-28 14:24:39 -07:00
Terence Parr 680df17280 rm transient context cache for closure computations; slight speed improvement maybe. less complex. 2012-07-28 10:51:07 -07:00
Terence Parr 26165c5d54 atnconfigsets can be readonly now. no copying to put into new DFA state, set readonly instead. made atnconfigset.equals() more accurate. add -notree option to test java lr 2012-07-27 10:34:59 -07:00
Terence Parr 3c7b4c2a33 big cleanup. 2012-07-26 17:28:10 -07:00
Terence Parr 48ddc0bcee add gc() 2012-07-26 12:42:10 -07:00
Terence Parr 86a4f26596 still has dfa and local predict ctx cache, but doesn't help much, and takes time. Eval preds as we pass them in full ctx mode; no sempred ctx in configs then. removed LANDMINE!!!!!!!!! some lame code that uses fields like _startIndex; fix that. added bail option to testjavalr. 18s to parse java.* with javalr full ctx now. 2012-07-25 18:47:34 -07:00
Terence Parr 3774c5752b add more tracking var 2012-07-25 10:30:19 -07:00
Terence Parr 3cec976f7e Don't pursue the closure if there is just one state or it's predicting unique alt. Fixed up computeReachSet() to do this. Dropped from 6s to 4.5s for TestJavaLR -SLL on java.* with 45M max footprint. 2012-07-24 18:45:23 -07:00
Terence Parr 2495ce6b20 add SLL option to the ATN simulator and use in TestJavaLR. 2012-07-24 17:42:47 -07:00
Terence Parr 2ae4d4eebd add ctx cache to merge op. now i get optimal graph it seems. doesn't seem longer for java.* with JavaLR. still landmine in Pattern.java, Foo.java. Made toDOTString sort predctx nodes by id for repeatable tests. updated unit tests. 2012-07-24 16:26:01 -07:00
Terence Parr ac4f00524e add ctx cache. 2012-07-24 14:19:43 -07:00
Terence Parr 320868d661 added code chking size of ctxs. changed configsets -> configs. added recur getallnodes. 2012-07-24 10:04:51 -07:00
Terence Parr 00c4f98134 add test file that kills antlr 2012-07-23 10:35:02 -07:00
Terence Parr d8a9207041 improve combine common parents, return a or b in merge array of merged is a or b; new unit test. 2012-07-22 20:07:46 -07:00
Terence Parr e18b9132d9 cleanup and merge common parents for array merge; fixes unit test 2012-07-22 16:39:53 -07:00
Terence Parr f7eeca274f reorg closure and fix bug where $ in arrayctx wouldn't perform global follow. fix case in array merge that didn't check both a[i], b[i] as $ (only matters in full ctx). unit tests for graph show fewer ctx's created. 2012-07-22 16:09:45 -07:00
Terence Parr eb78593469 rm comment 2012-07-22 15:43:01 -07:00
Terence Parr 44ae1dad0b if merged array is 1 node, return singleton. more unit tests 2012-07-22 15:05:12 -07:00
Terence Parr 829ad9191c didn't join a$ + bx as [a,b]$ for local ctx. new unit test to chk 2012-07-22 12:57:30 -07:00
Terence Parr 43424cd5df do check for a==b in merge(); improve DOT output 2012-07-22 12:10:40 -07:00
Terence Parr 93945d47f5 Merge branch 'master' into stack-graphs-integration 2012-07-21 16:27:36 -07:00
Terence Parr 9539572ee7 simplify test. 2012-07-21 16:27:00 -07:00
Terence Parr 7a4a269615 fix test so no error due to EOF. 2012-07-21 15:36:56 -07:00
Terence Parr 8c03dbacf8 Resolves #41. EOF cannot follow s. would need s' : s EOF ; for that. updating unit test TestParserExec.testOptional 2012-07-21 15:29:07 -07:00
Terence Parr 991014d3f2 clean up, add comments, fix graph unit tests, updated toDotString(). 2012-07-21 15:10:15 -07:00
Terence Parr 0141bc058a merge from master,In preparation for continuing on this experiment branch. 2012-07-21 10:38:55 -07:00
Sam Harwell 885f6530ad Use chained calls to append instead of string concatenation 2012-07-20 14:52:49 -05:00
Sam Harwell 6259ab5c9e Use StringBuilder instead of StringBuffer 2012-07-20 14:52:48 -05:00
Sam Harwell 2056e019a5 Use HashMap instead of Hashtable 2012-07-20 14:52:47 -05:00
Sam Harwell 44ef41ff29 Remove unnecessary variable initializations 2012-07-20 14:52:46 -05:00
Sam Harwell 6045bd4eb5 Add null check 2012-07-20 14:52:45 -05:00
Sam Harwell 84e1025801 Remove extraneous ';' (empty statement), remove unnecessary null checks and dead code 2012-07-20 14:52:44 -05:00
Sam Harwell 3b9940b02a Use isEmpty() instead of comparing size() with 0 2012-07-20 14:52:43 -05:00
Sam Harwell 4c4f767d17 Prevent NPE after reporting error 2012-07-20 14:52:13 -05:00
Sam Harwell 4c1e9b4119 Improve performance of equals 2012-07-20 14:51:55 -05:00
Sam Harwell 3a35f3cb08 Check object type in equals 2012-07-20 14:51:53 -05:00
Sam Harwell 8b4a461262 Merge branch 'ModelElement' 2012-07-18 16:14:14 -05:00
Sam Harwell 29d71acef9 Update documentation 2012-07-18 16:12:37 -05:00
Sam Harwell 589d6bf187 Remove field which hides another field with the same name; add check for this condition to OutputModelWalker 2012-07-18 16:06:33 -05:00
Sam Harwell 45815d97f7 Specifically test for the ModelElement annotation on fields (not just any annotation will do) 2012-07-18 16:06:32 -05:00
Sam Harwell a37f8cf4f1 Add missing license notices 2012-07-18 15:57:48 -05:00
Terence Parr f220212a95 couldn't get Horstmann's routine to do EPS not PS so had to backtrack. 2012-07-14 16:32:04 -07:00
Sam Harwell 96654531b7 Use isEmpty() instead of size()==0, specify generic arguments 2012-07-13 14:33:42 -05:00
Terence Parr 683b915507 rm prints 2012-07-12 13:25:41 -07:00
Terence Parr 4923cb3874 reorg r : '...' ; matching. deals with -> cmds better (and more of em) 2012-07-12 13:25:18 -07:00
Terence Parr de744f912a allow A : '<' -> skip ; style token name/literal aliases. 2012-07-12 12:25:12 -07:00
Terence Parr 9738658126 rm unneeded code to set line/charpos 2012-07-09 17:32:03 -07:00
Terence Parr 3b2c0a6177 fix bug in get hidden channel stuff. rewrote. update test. 2012-07-07 18:48:48 -07:00
Terence Parr 00808ef11f off by 1 error. 2012-07-03 13:44:44 -07:00
Terence Parr d0e7e79b2b make sure tokenNames puts tokens at right spot; didn't handle wholes in token type sequence. 2012-07-03 13:37:43 -07:00
Terence Parr 9455f5cd30 bug fix; .tokens didn't allow ' ' or 'a b'. 2012-07-03 13:15:35 -07:00
Terence Parr 2e9c449ec4 fix a few tests 2012-07-03 12:42:10 -07:00
Terence Parr 1d9aef0a5e replace .tokens file parser with regex to avoid \t becoming tab char. 2012-07-03 12:40:36 -07:00
Terence Parr 3ad87ba12c rm generic parameter from ANTLRErrorListener, ripple effect. 2012-07-01 22:34:35 -07:00
Terence Parr 6053ac5269 rm gunit; hmm...my commits are wacked on this/last one. sorry! 2012-07-01 09:45:35 -07:00
Terence Parr 5c69d31e88 CommonTokenFactory now knows how to copy the text out of the character stream buffer before they disappear in unbuffered character strengths; added ctor.
Lexer now guarantees that the text of the current token is always available to the emit() method even if the character stream is unbuffered.

Added some hooks to see some of the internal data in the unbuffered character stream so that I can test it better.

Updated LexerInterpreter so that it uses the token factory.

Improved/added unit tests for the unbuffered character string.

Updated various comments
2012-06-30 16:40:16 -07:00
Terence Parr 44355d6ff6 oops; don't need these afterall 2012-06-30 16:36:25 -07:00
Terence Parr 0c22d12870 updated comments, remove duplicate code, add new functionality. 2012-06-29 13:02:44 -07:00
Terence Parr f396b4dc82 error->syntaxError in listener 2012-06-25 13:25:13 -07:00
Terence Parr 740208ee4d test code. 2012-06-17 16:56:26 -07:00
Terence Parr b18475113b Merge branch 'master' into interactive 2012-06-16 17:20:04 -07:00
Terence Parr bfc90d473c fix help msg slightly. 2012-06-13 12:42:21 -07:00
Terence Parr 3ece2c8640 merge from master; this pulls in the cleanup and bug fix in the lexer related to semantic predicates. 2012-06-08 10:18:49 -07:00
Terence Parr abc0e2ef87 add getSpeculativeText(); text matched so far in a lexer rule. Use this in predicates not actions. add unit tests. 2012-06-07 18:31:36 -07:00
Terence Parr b255509e96 fix a bug related to semantic predicates in the lexer and generally cleaned up variable and method names in the simulator. I moved all of the predicates to the right side of lexer rules in the unit tests. Later, we should ensure that predicates only occur on the right edge of lexer rules. We should state that the rule is not been accepted so we can't test things like getText(), we have to use more raw indexes into the character stream. In the lexer simulator, the addDFAState() method now does not try to compute whether there is a predicate in the configurations. That information has already been set into the ATNConfigSet by the getEpsilonTarget() method. [I should also point out that I have not tested the Java parsing in a while and now it hits a landmine on a number of common Java files in jdk :(. I'm not sure where that crept in] 2012-06-07 17:31:18 -07:00
Terence Parr d3c238569f fix unit test. 2012-06-06 15:44:10 -07:00
Terence Parr 5a2197a74d fix bug where X : 'x' {pred}? ; wasn't seen as alias from X to 'x'. 2012-06-02 11:44:27 -07:00
Terence Parr 7192cc9a68 rm deadcode 2012-06-02 11:44:01 -07:00
Terence Parr e1524fe86c add test 2012-06-02 11:28:25 -07:00
Terence Parr 0e9bcfbeca change in token type broke many tests; fixed. says 5 failures now. 2012-06-02 11:26:18 -07:00
Terence Parr 5a2fe297e3 ack. more cleanup work will be required for change of token types from 3..n to 1..n 2012-06-01 18:08:00 -07:00
Terence Parr 8481979f69 rename method 2012-06-01 18:06:48 -07:00
Terence Parr 94071d7d82 prevent negative indexes 2012-06-01 17:36:21 -07:00
Terence Parr de83aacb65 add unit test 2012-05-31 17:02:15 -07:00
Terence Parr 3b1d91e010 fix unit tests 2012-05-24 13:08:15 -07:00
Terence Parr 6539c5f464 remove inappropriate attributes of lexer rules 2012-05-24 13:07:43 -07:00
Terence Parr cd82465830 updated [...] parser so it handles < > and [ ] properly. no escapes now. 2012-05-23 12:48:07 -07:00
Terence Parr bc236a6e0b no tree attribute 2012-05-22 16:54:45 -07:00
Terence Parr 8078d39053 rm "st" attribute 2012-05-22 16:42:05 -07:00
Terence Parr 868ca7ca6d named actions in combined get copied to lexer now, but lexer::{...} are MOVED to lexer grammar. 2012-05-22 16:21:06 -07:00
Terence Parr ed879ab4e3 working towards interactive lexer 2012-05-21 10:16:37 -07:00
Terence Parr d378469c9c rename 2012-05-20 18:06:43 -07:00
Terence Parr 990da7d1d8 add unit test 2012-05-19 18:08:56 -07:00
Terence Parr c590ba8fd8 don't look backwards for err msg if EOF is entire input. make sure we don't use -1 rule index for ruleNames[] 2012-04-29 12:12:42 -07:00
Terence Parr 3ea6a5cb2f Merge branch 'master' into stack-graphs-integration
Conflicts:
	tool/playground/T.g
2012-04-26 12:01:28 -07:00
Terence Parr 6314b7d31b -> becomes # for alt labels 2012-04-26 11:59:57 -07:00
Terence Parr f4abc84054 MutableInt's compare method was messed up. 2012-04-10 10:51:51 -07:00
Sam Harwell 95f5cc6b8b Support specifying the inputDirectory in code 2012-04-10 09:49:31 -05:00
Terence Parr d22eb34fe7 Merge branch 'master' into stack-graphs-integration 2012-04-05 16:35:56 -07:00
Sam Harwell 9d92446125 Merge remote-tracking branch 'parrt/master' into basetest-error-reporting 2012-04-04 15:38:03 -05:00
Terence Parr 08e3ddefc0 Merge branch 'master' into stack-graphs-integration 2012-04-04 13:22:00 -07:00
Terence Parr 585aa0a14b Merge branch 'tokenstreamrewriter' of git://github.com/sharwell/antlr4 2012-04-04 13:20:58 -07:00
Sam Harwell ff2655d379 Rename getSource() to getTokenStream() 2012-04-04 15:20:45 -05:00
Terence Parr 8155b1138e Merge branch 'implicit-tokens' of git://github.com/sharwell/antlr4 2012-04-04 13:11:02 -07:00
Terence Parr 8658be69ba Merge branch 'test-reporting' of git://github.com/sharwell/antlr4 2012-04-04 13:08:07 -07:00
Sam Harwell bbd61dca35 Remove TokenStreamRewriter.getOriginalText() (use rewriter.getSource().getText() instead) 2012-04-04 10:15:29 -05:00
Sam Harwell d054a358a4 Don't run compiler if tool reported error(s) 2012-04-04 09:57:38 -05:00
Sam Harwell 7082590240 Allow tests to use the default tool listener for error reporting (prints formatted error messages). Use this in TestPerformance. 2012-04-04 09:56:32 -05:00
Sam Harwell 64e0a8734f Report warnings as well as errors 2012-04-04 09:53:10 -05:00
Sam Harwell 2c1f673f62 Mark ErrorType fields final 2012-04-04 09:51:23 -05:00
Sam Harwell 1c9e52b5d6 Use CopyOnWriteArrayList instead of Collections.synchronizedList 2012-04-04 09:50:51 -05:00
Sam Harwell 4304ba251f Treat warnings as errors in TestPerformance 2012-04-04 09:49:16 -05:00
Sam Harwell 9fd02cfd00 Add the -Werror command line option - upon warning emits new error 9: warning treated as error 2012-04-04 09:45:20 -05:00
Sam Harwell 251490cfc9 Fix unit tests which included implicitly defined string literal tokens 2012-04-04 09:39:44 -05:00
Sam Harwell 9ce85cc6e4 Add error 126: implicit definition of string literal token in non-combined grammar 2012-04-04 09:38:28 -05:00
Sam Harwell c3e5c42c51 Fix (broken) unit tests which included implicitly defined tokens 2012-04-03 16:42:22 -05:00
Sam Harwell b433c2ae34 Add warning 125: implicit definition of token in parser 2012-04-03 16:40:52 -05:00
Terence Parr bf9c7c3a28 Remove old TokenRewriteStream in favor of new TokenStreamRewriter that is not a stream; it feeds off of the stream to provide transformations of that original stream. Updated the comment at the top of the file. Instead of toString() we use getText(). Altered the unit tests to create a buffered stream and then create the rewriter attached to that. 2012-04-02 18:10:32 -07:00
Terence Parr 3849cd572d rm SymbolStream<T>, change all to TokenStream. all but 5 tests pass. 2012-04-02 16:49:04 -07:00
Sam Harwell 78fcc134cd Fix error codes in unit tests 2012-04-02 18:22:05 -05:00
Sam Harwell 5fd8b223b6 Fix ErrorManager ignoring error code in messages 2012-04-02 18:13:47 -05:00
Terence Parr 186293ae86 tweak 2012-04-02 10:13:13 -07:00
Terence Parr 9ef6127982 merging from master 2012-04-01 18:13:40 -07:00
Sam Harwell adad53ee18 Fix unit tests that called TokenStream.toString (now TokenStream.getText) 2012-04-01 18:33:49 -05:00
Terence Parr e1870d16e9 added convenience getText(ctx) method to TokenStream. unlikley to need in CharStream and can get another way 2012-04-01 12:23:45 -07:00
Terence Parr 588e30bfe1 getText(...) moved to CharStream and TokenStream; cleaned up names. removed getInputString from parser. 2012-04-01 12:12:49 -07:00
Terence Parr c9aef6fdbe Merge branch 'master' into stack-graphs-integration 2012-03-31 10:33:22 -07:00
Terence Parr 9fbe9b6e21 op=(x|y) works as left-recur binary op now. 2012-03-30 13:00:31 -07:00
Sam Harwell f166df7b94 Updated unit tests to use .g4 as the preferred grammar extension 2012-03-30 11:44:34 -05:00
Sam Harwell e5d7c27b09 Updated comments to indicate preference of .g4 over .g 2012-03-30 11:37:22 -05:00
Sam Harwell cfcb2a1a55 Add Tool.GRAMMAR_EXTENSION (.g4) and Tool.LEGACY_GRAMMAR_EXTENSION (.g), allow imported grammars to use either extension (favoring .g4 over .g). 2012-03-30 11:36:20 -05:00
Terence Parr 11cd720cc6 added failing test so i go back and fix issue with op=('+'|'-') in LR rules 2012-03-29 21:37:56 -07:00
Terence Parr 42706485e9 was looking for imports with .g not .g4 2012-03-29 14:59:43 -07:00
Terence Parr 48b2e237d1 Merge branch 'no-rules-npe' of https://github.com/sharwell/antlr4 2012-03-27 21:23:47 -07:00
Sam Harwell cc7e9c1b0c Don't strip error numbers from lines because the numbers are constants of the public API 2012-03-27 21:52:34 -05:00
Sam Harwell 8d16912fb9 Fix expected output for testAmbigLR 2012-03-27 21:51:55 -05:00
Sam Harwell 2ff9c12848 Fix expected error/warning numbers 2012-03-27 21:51:31 -05:00
Sam Harwell 95b6cd58c4 Fix NPE when a grammar contains no rules (instead of appropriate error message) 2012-03-27 21:25:23 -05:00
Sam Harwell eb48cdf55b Fix test affected by 9c1e58db7c (add {} in primary alt block of LR rule) 2012-03-27 21:22:04 -05:00
Sam Harwell 4b0040f2a1 Fix test affected by bdda174af6 (set stop token even if exception occurs) 2012-03-27 21:20:29 -05:00
Terence Parr a363e70582 pull from master 2012-03-27 16:22:01 -07:00
Terence Parr 9c1e58db7c add {} in primary alt block to prevent ID|INT from becoming SET, which breaks code gen needs. 2012-03-27 16:21:01 -07:00
Terence Parr bd51907c5e Merge branch 'abstract-parser' of github.com:sharwell/antlr4 2012-03-27 15:18:06 -07:00
Terence Parr bf07f7907f Merge branch 'override-ruleindex' of github.com:sharwell/antlr4 2012-03-27 15:09:50 -07:00
Terence Parr 41e97791bb Merge branch 'set-stop-token' of github.com:sharwell/antlr4 2012-03-27 15:08:57 -07:00
Terence Parr 580ec1f7d7 Merge branch 'fix-tests' of github.com:sharwell/antlr4 2012-03-27 15:07:05 -07:00
Terence Parr f307945d2a Merge branch 'lexer-npe' of github.com:sharwell/antlr4 2012-03-27 15:06:17 -07:00
Terence Parr 8465920343 Merge branch 'atnstate-reachability-test' of github.com:sharwell/antlr4 2012-03-27 15:05:39 -07:00
Sam Harwell e8765ef241 Fix errors tracking current state on rule return 2012-03-26 23:29:53 -05:00
Sam Harwell 9b42e7dfe6 Implement support for abstract grammars via the "abstract" grammar option and "-abstract" command line option. Resolves antlr/antlr4#36. 2012-03-26 18:00:16 -05:00
Sam Harwell df2e24a228 Override getRuleIndex() in generated context objects so ParserRuleContext.ruleIndex field can be removed 2012-03-25 21:50:55 -05:00
Sam Harwell fdb92ccf6d Fix tests affected by 9a0aaacbee and 2232ea5101 2012-03-25 21:50:31 -05:00
Sam Harwell be4caa3d11 Fix tests affected by c6365fb5e2 2012-03-25 21:50:30 -05:00
Sam Harwell bdda174af6 Set stop token even when RecognitionException occurs. Add ParserRuleContext.exception field to hold exception if one occurs. Resolves antlr/antlr4#49. 2012-03-25 21:50:12 -05:00
Terence Parr 2b5896e83b Merge branch 'master' into stack-graphs-integration 2012-03-25 10:08:29 -07:00
Terence Parr 6791bf60cf Merge commit '3f1f76d' into parrt-default-error-listener
Conflicts:
	runtime/Java/src/org/antlr/v4/runtime/ANTLRErrorStrategy.java
	runtime/Java/src/org/antlr/v4/runtime/DefaultErrorStrategy.java
	runtime/Java/src/org/antlr/v4/runtime/DiagnosticErrorListener.java
	runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java
2012-03-24 16:44:47 -07:00
Terence Parr b035ceec9e EMPTY gives "" not "$" now. rename closure->closure_. had return in wrong spot in closure for-loop. fix fromRuleContext. 2012-03-20 19:06:52 -07:00
Terence Parr 0f969af947 added in Sam's popAll to deal with loop end push/pop stuff. passes LR tests and all but 2 sempred tests. does some JavaLR.g4 parsing too. 2012-03-20 18:06:00 -07:00
Terence Parr 9318391664 tweak to fromRuleContext. more sempred tests work. 2012-03-20 12:32:28 -07:00
Terence Parr 55ed1a45bf lexer wasn't using new prediction context. weird. put in functionality for $ merge in full ctx mode. removed configs array in ATNConfigSet. ATNConfigSet wasn't tracking lexerActionIndex from config. ATNConfigSet now maps key to ATNConfig. 2012-03-20 12:12:18 -07:00
Terence Parr 5945b29a86 got more working 2012-03-19 19:58:04 -07:00
Terence Parr 7e9a86a3e1 got TestATNInterpreter working 2012-03-19 18:47:41 -07:00
Terence Parr 85b40c7d2e shelve 2012-03-19 17:47:57 -07:00
Sam Harwell 4bc615d72f Ensure that serialized transitions only point to states which weren't removed. Add unit test for a current failure case (will be a regression test once fixed). 2012-03-19 08:32:34 -05:00
Sam Harwell a70cb6f36a Fix NPE in LexerATNSimulator.execDFA error recovery 2012-03-19 08:17:59 -05:00
Terence Parr 7233177441 got integrated graph stacks to compile. commit so i can look at sam's 2012-03-18 15:20:52 -07:00
Terence Parr 3a79aa15ba move new classes into proper package locations 2012-03-18 13:45:13 -07:00
Sam Harwell ea434982fb Pull error reporting outside of try/finally to ensure errors are not hidden 2012-03-17 17:38:05 -05:00
Sam Harwell e8830ae51a Fix handling of consume() at EOF in BufferedTokenStream and derived 2012-03-17 17:30:52 -05:00
Sam Harwell 525b90fe9a Add tests for CommonTokenStream handling of consume() at EOF 2012-03-17 17:30:48 -05:00
Sam Harwell 7e910e90a9 Don't allow BufferedTokenStream to be constructed without a non-null TokenSource 2012-03-17 17:30:47 -05:00
Terence Parr 9a0aaacbee rm k=1 chk to report early ambiguity. 2012-03-16 14:11:21 -07:00
Terence Parr 102980dffd make T.g same 2012-03-14 13:20:24 -07:00
Terence Parr 28ee391c81 Merge remote-tracking branch 'sharwell/loops-recursion-test' 2012-03-14 13:09:19 -07:00
Sam Harwell 0ec7f1528c Clean up testLoopsSimulateTailRecursion, move to TestFullContextParsing. 2012-03-14 15:04:01 -05:00
Sam Harwell ee0bc39b53 Add unit test for loopsSimulateTailRecursion 2012-03-14 14:08:22 -05:00
Terence Parr 6887c86d5e shelve 2012-03-14 12:04:18 -07:00
Terence Parr 2fc9760ba7 Merge remote-tracking branch 'sharwell/ambig-sempred' 2012-03-12 13:50:45 -07:00
Sam Harwell 3f1f76df7d Move reportAmbiguity, reportContextSensitivity, reportAttemptingFullContext, reportInsufficientPredicates from ANTLRErrorStrategy to ANTLRErrorListener.
Add BaseErrorListener to allow implementing ANTLRErrorListener without implementing every method (e.g. ConsoleErrorListener).
DiagnosticErrorStrategy is now DiagnosticErrorListener, updated tests.
2012-03-12 15:07:48 -05:00
Sam Harwell bbff5bd20a New tests related to if/if/else constructs 2012-03-12 07:26:39 -05:00
Sam Harwell 2cc39c2f9b Evaluate predicates for all ambiguous alternatives and report if still ambiguous after predicate evaluation. Remove misleading message insufficient predicates. Fixes antlr/antlr4#31. Partially addresses antlr/antlr4#39. 2012-03-10 16:16:39 -06:00
Sam Harwell 7525bb6e1d Semantic predicates now evaluate with standard min-alt selection 2012-03-08 13:53:45 -06:00
Terence Parr a9e74ce399 Merge branch 'failed-predicate-message' of git://github.com/sharwell/antlr4 2012-03-06 13:28:47 -08:00
Terence Parr ce142a2a4c Merge commit '51c38c1' 2012-03-06 13:27:46 -08:00
Sam Harwell 5280bc3280 Tweak doc comment 2012-03-06 07:34:20 -06:00
Sam Harwell c3cd99858c Reduce size of generated code by emitting predicate text instead of full failed predicate message 2012-02-29 08:14:42 -06:00
Sam Harwell 51c38c1103 Use single int _alt in generated code instead of a new _alt<choice.uniqueID> for each PlusBlock and StarBlock 2012-02-29 07:56:29 -06:00
Terence Parr dd69a7532d getToken/s returns TerminalNode now per Sam's suggestion. altered tests. seems correct. 2012-02-27 21:39:30 -08:00
Terence Parr ae08867ff3 alter visitTerminal interface, add visitErrorNode. 2012-02-26 22:07:45 -08:00
Terence Parr 67b2e6d7c1 forgot to move Pair etc... 2012-02-26 21:55:23 -08:00
Terence Parr 41be88dcd5 mv to runtime 2012-02-26 15:49:45 -08:00
Terence Parr b7da3361de fix bug. e : e '(' exprList ')' ... ; came back with e as a list not single element. 2012-02-26 15:33:05 -08:00
Terence Parr db1b86af91 alter visitTerminal interface, add visitErrorNode. 2012-02-25 17:03:41 -08:00
Terence Parr 600c4bbd91 crap. sun already made IdentityHashMap; rm'ing my version 2012-02-25 16:07:34 -08:00
Terence Parr 73ae2b0bfc Added ParseTreeProperty and added generically useful Map that ignores key.hashCode and equals() and simply uses key identity instead. In particular, this is useful for ANTLR because parse trees are actually interfaces laid on top of the rule context objects used by ANTLR's grammar analysis. These context objects use special equals methods and so on. Plus, when we want to annotate trees with values, we want a specific note to have a value. Identity is what we intend. 2012-02-25 13:43:32 -08:00
Sam Harwell 90bcfec456 Simplify CodeGenerator 2012-02-24 15:58:21 -06:00
Sam Harwell 019ea15e3f Catch specific RecognitionException instead of Exception 2012-02-23 16:45:35 -06:00
Sam Harwell 2c8ef6470f Despite being absurdly verbose in Java, use callable objects instead of reflection in CodeGenerator because the latter is prone to runtime errors and debugging headaches 2012-02-23 16:44:54 -06:00
Sam Harwell 9bf6f284df Code cleanup (little things like using .isEmpty() and StringBuilder, and specify some small-scale generic arguments) 2012-02-23 16:42:36 -06:00
Sam Harwell 1c8efd6a48 Allow contravariant error listeners 2012-02-23 16:13:13 -06:00
Sam Harwell 4ae58868d7 Compile listeners and visitors with the unit tests by default to help catch compile errors with them 2012-02-23 16:13:10 -06:00
Sam Harwell db4ce6dd8e Unexpected v3 RecognitionException should cause testActions to fail 2012-02-23 16:13:09 -06:00
Sam Harwell 5ab1c3319c Make sure failed compiles result in failed unit tests 2012-02-23 16:13:08 -06:00
Sam Harwell 44df49f24f Remove tree parser methods from BaseTest 2012-02-23 16:13:07 -06:00
Sam Harwell 1492648d26 Add missing @Override annotations 2012-02-23 16:13:06 -06:00
Terence Parr b459dafeb9 empty alternatives didn't trigger listener events. overrode getParent in ParserRuleContext to make type more specific. 2012-02-23 12:16:14 -08:00
Terence Parr 5a13ddc517 fix regression; LR rules weren't working 2012-02-23 11:37:50 -08:00
Terence Parr d30b36ca01 tweak to compile with 3.4 2012-02-23 10:05:43 -08:00
Sam Harwell 4aee8aa4dc Merge remote-tracking branch 'parrt/master' 2012-02-22 15:46:22 -06:00
Sam Harwell 7c0d5cd726 Fix use of v3 runtime generics 2012-02-22 15:44:17 -06:00
Terence Parr 8a34176d82 added listener unit tests. fixed bug that didn't create ctx getters properly for recursive rules. added Symbol extends Token to parse tree stuff. added visitTerminal to Visitor. recursive alts now track their original, unedited AltAST subtree so we can properly count rule refs etc... later. dup of RuleRefAST was making wrong node. don't gen dispatch methods if no listener. 2012-02-22 12:44:33 -08:00
Sam Harwell 05930b04ce Use Class.asSubclass instead of unchecked cast 2012-02-21 07:50:02 -06:00
Sam Harwell 1970ac240e Generalize several functions in TestPerformance 2012-02-20 20:59:06 -06:00
Sam Harwell 611728a380 Update testPerformance to show information about DFA states in the lexer 2012-02-20 18:51:26 -06:00
Sam Harwell f5edb7653a Add missing @Override attributes in generated code, use hard tabs instead of spaces 2012-02-20 17:23:38 -06:00
Sam Harwell ca0b1d399c Move "metadata" methods to top of generated parser 2012-02-20 17:21:44 -06:00
Sam Harwell a81b1a17eb Extract abstract method in Recognizer for Parser.getGrammarFileName() and generated lexer's getGrammarFileName(). Make Recognizer.getTokenNames(), getRuleNames(), and getATN() abstract - implementations are always generated. 2012-02-20 17:18:57 -06:00
Sam Harwell d166e6d5d1 Emit grammar file name instead of generated class file name in generated implementation of getGrammarFileName(). Implement getGrammarFileName() in generated parser. 2012-02-20 17:14:19 -06:00
Sam Harwell 8773c34375 Fix unit tests 2012-02-20 15:58:21 -06:00
Terence Parr 97660e21ae add alt labels to all alts 2012-02-20 12:26:32 -08:00
Terence Parr e9122cafa3 Merge commit '46d5458' 2012-02-20 12:22:37 -08:00
Terence Parr 1a2094b2dd merging Sam\'s fix to full ctx pred etc...; effectively did pull parrt/antlr4#15, includes fixes antlr/antlr4#14, includes fixes antlr/antlr4#15 2012-02-20 11:48:03 -08:00
Terence Parr 7287f5a2d3 prefix left-recursive alts weren't recognized with actions on end. 2012-02-20 10:51:34 -08:00
Terence Parr 642177f716 forgot to add dispatch methods in context objects. in-parse listeners should work now. 2012-02-19 11:25:15 -08:00
Terence Parr 4e8931519c added -parse-listener option and generated code if option on. parse listener differs from tree listener 2012-02-18 16:49:05 -08:00
Terence Parr 71b75c88dd Fix regression; did not gen enter/exit in alt label structs. 2012-02-18 15:16:42 -08:00
Terence Parr c6fd897287 altered naming scheme for listeners/visitors
* names changed. visit() -> visitX(). enter/exit() -> enter/exitX()
* capitalizing automatically now. rule s -> SContext not sContext
* no enter/exit method in generic rule context object if rule has alt labels, nor in interfaces.
* dup labels allowed in same rule
* label X or x illegal if rule x exists
2012-02-18 12:40:47 -08:00
Terence Parr 725b105135 Added visitor gen mechanism, runtime support 2012-02-16 17:49:57 -08:00
Sam Harwell 82aac56c98 Fix rule list labels 2012-02-16 17:35:01 -06:00
Sam Harwell 0520400493 TestPerformance: print additional information about states/configs 2012-02-16 15:41:43 -06:00
Sam Harwell feeaffc710 Fix listener name BlankJavaListener->JavaBaseListener 2012-02-15 19:06:27 -06:00
Sam Harwell 27806dc490 Merge remote-tracking branch 'parrt/master' 2012-02-15 14:58:16 -06:00
Sam Harwell 79f0de4cde Fix unit test checking for incorrect input index in warning message 2012-02-15 13:51:28 -06:00
Sam Harwell 685cf7b7d5 Further improvements to auto-label generic usage, return Collections.emptyList() instead of null when no children are found 2012-02-15 12:31:43 -06:00
Sam Harwell bc87562aff Remove unused exception LexerRecognitionExeption [sic] 2012-02-15 11:01:01 -06:00
Sam Harwell 2d2134eb6b Update BaseTest to compile XBaseListener instead of BlankXListener 2012-02-15 10:48:49 -06:00
Sam Harwell 40af402822 Allow enabling TEST_IN_SAME_PROCESS via jvm argument 2012-02-15 10:47:50 -06:00
Sam Harwell 707311996d Updated TestPerformance (features, grammar fixes) 2012-02-15 10:28:59 -06:00
Sam Harwell 19afb4a8bc Specify surefire plugin version 2012-02-15 10:28:58 -06:00
Terence Parr 3d56d40975 update playground 2012-02-14 16:33:34 -08:00
Terence Parr fa3a664696 got some good examples working that play around with the getter methods. 2012-02-14 16:33:12 -08:00
Terence Parr e30627c967 updated command line options. 2012-02-14 15:14:46 -08:00
Terence Parr cdb420fdde got implementation of getters in! Fixes #8 2012-02-14 15:01:03 -08:00
Terence Parr b8f50d46e7 update playground 2012-02-14 13:59:53 -08:00
Terence Parr a6786743d4 got it generating getters, labels correctly. now to impl getters 2012-02-14 13:58:48 -08:00
Terence Parr 6c2beb530d see A.g4 for getter syntax; use e() not gete(). adding ContextGetterDecl.java 2012-02-13 20:47:19 -08:00
Terence Parr 203ad46820 fixed 8 unit tests; only 9 fail now. 2012-02-13 17:47:26 -08:00
Terence Parr 0031075da2 Merge branch 'master' into enhance-ctx 2012-02-13 17:36:56 -08:00
Terence Parr 2091f2d001 change enterRule to enter in listener interface 2012-02-13 17:35:29 -08:00
Terence Parr 7b672c31da Merge pull request #11 from sharwell/clean-tests
Clean tests
2012-02-13 15:38:39 -08:00
Sam Harwell 146a9b0509 Fix unit test placing output files like "null.java" in the project directory 2012-02-13 16:32:42 -06:00
Terence Parr b68ce1f5aa almost got ctx stuff working 2012-02-13 11:47:26 -08:00
Terence Parr 97ab2c42da mode wasn't working as lexer command 2012-02-13 11:45:10 -08:00
Terence Parr ebb8b3a15b Merge branch 'master' of github.com:parrt/antlr4 into enhance-ctx 2012-02-13 10:20:09 -08:00
Terence Parr d06b83fd22 Merge pull request #8 from sharwell/62146c1651620445e96303e5522eddc2105f2379
Removed redundant check for null
2012-02-13 10:19:30 -08:00
Terence Parr 8af1e23461 adding tests 2012-02-13 09:16:29 -08:00
Terence Parr 3dbf4cdabc mid-job push so i can pull from work to continue. working on updating ctx objects to have getters 2012-02-13 09:15:54 -08:00
Terence Parr f8285bcca0 another useful tuple 2012-02-13 09:15:05 -08:00
Sam Harwell 62146c1651 Remove redundant null check 2012-02-12 23:33:01 -06:00
Terence Parr dee579a68f oops; need to alter this when removing up/down stuff 2012-02-11 17:46:02 -08:00
Terence Parr 808d23e6d1 add some useful classes 2012-02-11 17:42:02 -08:00
Terence Parr b80b22e4fa rm remnants of tree parser 2012-02-11 17:39:50 -08:00
Terence Parr f278d3b453 add unit test for left-recur grammars 2012-02-11 11:35:27 -08:00
Sam Harwell 702b91fab7 Ignore TestPerformance by default since it fails without special configuration 2012-02-09 13:30:44 -06:00
Sam Harwell 7fb73a3849 Construct DFA instances with the decision number 2012-02-09 13:29:14 -06:00
Sam Harwell d589011ad8 Small fixes to the Java grammars used in the performance test 2012-02-09 13:00:27 -06:00
Sam Harwell b686efb293 Code cleanup in unit tests 2012-02-09 12:42:48 -06:00
Sam Harwell 6304a562ea Fix unit tests 2012-02-09 08:45:19 -06:00
sharwell 46d5458617 Fix handling of alts with some configs predicated and some configs unpredicated (should be treated as always true) 2012-02-09 01:11:09 -06:00
sharwell f5f3861cb7 Fix unit test 2012-02-08 23:47:35 -06:00
sharwell 0ec084dc73 Simplified exec code in BaseTest 2012-02-08 19:27:34 -06:00
sharwell e5aa949435 More informative parameter names 2012-02-08 19:26:05 -06:00
sharwell 05a199ed2d Compile grammars with debug info for tests 2012-02-08 19:24:21 -06:00
sharwell 32aefbce74 Fix start/stop indexes for contexts created by LR rules 2012-02-08 19:22:26 -06:00
sharwell 851069d87b Hard tabs in generated code 2012-02-08 19:17:36 -06:00
sharwell 33c8f9b2d6 Suppress "cast" warnings in generated code 2012-02-08 19:14:25 -06:00
sharwell 4f3e40f0d3 Use List instead of Vector 2012-02-08 19:06:32 -06:00
sharwell 5279b250ca Use isEmpty() instead of size()==0, use StringBuilder instead of StringBuffer, use chained append() calls instead of string concatenation, remove unnecessary initializations. 2012-02-08 19:01:28 -06:00
sharwell 21a855e94e Specify generic type parameters in generated code 2012-02-08 18:55:20 -06:00
sharwell a6524d8b38 Add pom.xml to support maven builds 2012-02-08 15:07:06 -06:00
Terence Parr 5c79fc600a ["\\] didn't work in lexer 2012-02-07 13:19:12 -08:00
Terence Parr 59e4a54faa alter tests for new parser atn name 2012-02-07 13:18:51 -08:00
Terence Parr a5a403514d oops; forgot to update the templates when I renamed the ATN simulator 2012-02-06 09:46:59 -08:00
Terence Parr 894a77168d rename atn sim, add error message to TestRig 2012-02-05 10:14:04 -08:00
Terence Parr c47c07299a ugh. fix "[a-z]" for real now 2012-02-02 10:41:27 -08:00
Terence Parr c94037def5 fixed regression "a returns [int i] : A ;" didn't work. 2012-02-01 15:55:49 -08:00
Terence Parr 5eb9ec9582 fixed bug in [a-z] 2012-01-30 18:08:22 -08:00
Terence Parr 0a5803fab4 useless tweaks 2012-01-30 17:09:29 -08:00
Terence Parr 1cc7ac3410 added -trace to TestRig. fixed code gen issue for trace listener 2012-01-30 16:51:55 -08:00
parrt e90b322dd4 ~[] stuff is allowed and works inside sets etc...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9926]
2012-01-28 14:36:46 -08:00
parrt 368b70d53c get 'x' not x in tokenNames
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9925]
2012-01-28 11:28:42 -08:00
parrt f4ecc75df5 allows " in [] char set now.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9923]
2012-01-28 10:46:08 -08:00
parrt 043afd3767 shelve for pull at home; don't sync ;)
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9914]
2012-01-27 15:38:11 -08:00
parrt 15d537ce6e Added ranges, escapes to [a-z] notation in lexer
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9897]
2012-01-22 11:37:15 -08:00
parrt 89ad588023 fix regression
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9896]
2012-01-22 09:55:13 -08:00
parrt 884472358d -> popMode was broken
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9893]
2012-01-21 21:21:19 -08:00
parrt 9fd280b30e Lexer fields mv from x to _x
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9883]
2012-01-21 15:36:20 -08:00
parrt 449c845dc0 more cleanup
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9882]
2012-01-21 15:29:33 -08:00
parrt fd0d280e6a cleanup
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9881]
2012-01-21 15:23:39 -08:00
parrt 4632d7f493 rule name change
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9880]
2012-01-21 15:16:00 -08:00
parrt 9ae5049d44 play with tests
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9879]
2012-01-21 15:15:01 -08:00
parrt 6013c4c97d Added modeNames to gen'd lexers
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9878]
2012-01-21 15:10:46 -08:00
parrt dc82edad02 Summary: we can have lexer commands like -> skip now.
moved model.actions package to chunk
type(foo) didn't match.
ATNBuilder.g now tracks the outer alternative number and calls new factory commands on the lexer commands.
Removed unnecessary resolveWithPredicate field from ATNConfig
Added lexerActionIndex field to ATNConfig since we need to track whether we passed an action in an alternative will rule in the lexer.
Renamed ruleIndex in DFAState and added the lexer action index so that we can execute lexer actions from the DFA.
added functions to the grammar tree visitor for the lexer commands.
Added templates for the lexer commands.
Augmented the lexer ATN factory so that it constructs plain old actions from the lexer commands it finds. That way, the code generator doesn't know any different and generates an action.
Augmented the lexer ATN simulator so that it fires a proper action index now. previously it only used the rule index, which of course doesn't work when you have more than one action in a rule.
rm'd dup code from OutputModelController
altered the epsilon edge removal optimization so that it could not remove actions in lexer rules.
Added list of valid lexer commands in Rule.

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9877]
2012-01-21 15:01:05 -08:00
parrt d321bb7854 fixed comment
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9876]
2012-01-21 14:49:20 -08:00
parrt 06e771f33a rm dead str
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9875]
2012-01-21 14:35:41 -08:00
parrt b90d41b508 wasn't walking lexer rule trees right.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9874]
2012-01-20 15:12:51 -08:00
parrt ec5e3e51b1 rm ForcedAction
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9873]
2012-01-20 15:12:32 -08:00
sharwell 252cfbda78 v4: integrate 9870 to main (unit test for partially predicated alts)
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9871]
2012-01-18 09:44:43 -08:00
parrt 491744f893 reuse of -> label on multiple alts in rule caused dup ctx object defs.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9868]
2012-01-14 13:12:35 -08:00
parrt 1ddf609e25 labels on tokens in left-recursive rules caused codegen exception.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9866]
2012-01-14 10:18:19 -08:00
parrt 73793898a9 update grammars
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9856]
2012-01-11 11:21:05 -08:00
parrt 848c6e4313 This change is a major restructuring of how left recursive rules are transformed. Previously I simply rewrote the grammar and ANTLR was none the wiser. However, it quickly became apparent that ANTLR needed to do many different things for recursive rules so I had to insert transformation later in the pipeline. Specifically, I needed it after Rule object creation. I made a special LeftRecursiveRule object that track information collected during transformation so that I could use it later. I made major changes to the left recursion templates as well as the little code snippets in Java.stg. I created a new template called LeftRecursiveRuleFunction an accompanying model object that handles the special case, even though there is some duplication. the biggest difference in the grammar is the introduction of => ID notation on any outermost alternative. This information is not added to the tree, instead the ALT node is annotated with the ID. Rule.getAltLabels() now looks also in the LeftRecursiveRuleAltInfo objects. I have moved to the left recursion transformation to its own object and have moved some objects into the analysis package. Further, I have split out the Rule object creation into its own RuleCollector. I renamed discoverAlt in the grammar tree visitor to be discoverOuterAlt an added discoverAlt so we can get information about individual alts even inside subrules. Listeners always get an event for the generic rule context, which is used if there is no specific label for an alternative. Added a list of iteration operations for LL(*) subrules. Split buildRuleFunction into buildLeftRecursiveRuleFunction and one for normal rule function creation. I have to insert lots of extra code to manage the contexts, but of course it's all done using the templates. As long as those templates are correct, this code generation mechanism will work. I removed the st field from the parser rule context. I injected the left recursion transformation inside the SemanticPipeline. Visitor dispatch methods are always added to the generated context structures. Fixed some unit tests. About 24 fail.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9854]
2012-01-11 11:00:05 -08:00
sharwell 742a08862f Merging dev changes to main
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9853]
2012-01-09 10:26:23 -08:00
parrt e8ae8ee005 labels allowed in left recursive rule refs.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9834]
2012-01-05 18:35:20 -08:00
parrt 4ae23f4a64 * 1+2*3 now gives new parse tree: (e (e 1) + (e (e 2) * (e 3))) See CHANGES.txt now too
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9833]
2012-01-05 12:27:14 -08:00
parrt 2e8a5f391a no more -trace
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9826]
2012-01-04 17:41:42 -08:00
parrt 78c7c254a0 rm cmt'd out prints
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9825]
2012-01-04 17:40:59 -08:00
parrt 7d68546dbe rm prints
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9824]
2012-01-04 17:37:15 -08:00
parrt e7f6ba5ac1 lr rules now gen only 1 rule e->e not e->e_ etc... altered tests to build parse trees.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9823]
2012-01-04 17:36:24 -08:00
parrt e29b11882d fix unit tests
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9816]
2012-01-04 15:47:52 -08:00
parrt b2269a22f4 not needed
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9815]
2012-01-04 15:42:55 -08:00
parrt 8099cec3bd Added ctx to visitTerminal in parse tree listener. That should be useful information. made commensurate change in the parse tree walker to make sure I have a proper context to send to the visitTerminal method. renamed a few fields of parser/lexer to have _ in front to avoid name collisions with user actions. change the name of the listener method so that they're more explicit using the terms Error and Parser to identify what kind of listener we are adding or removing. Added a default TraceListener to Parser so that we can call setTrace(true) to have it start dumping out information as a first step in the debugging process. there are now multiple parse tree listeners possible because I made a list. we may want to pass in multiple actions to the parser.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9795]
2012-01-03 12:46:18 -08:00
parrt 1d6bbb08c3 kill
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9793]
2012-01-03 12:30:21 -08:00
parrt 2d9139ca4d remove % from ActionSplitter.g
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9790]
2012-01-03 11:04:12 -08:00
parrt 5c3c8d6e7a Added TokenFactory, CommonTokenFactory. Update the parser in the lexer with methods to set the factory. Alter the default error strategy and the lexer to use the factory. The parser's set token factory method updates the token source, usually the lexer, and the error handling strategy. I had to add the set token factory method to token source as well to make all of this work.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9789]
2012-01-03 10:58:01 -08:00
parrt 3aeeb2b277 rename BaseREcognizer as Parser
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9781]
2012-01-02 18:36:59 -08:00
parrt 1b04195a2f removed all template / AST rewrite stuff; massive change; added -encoding tool option
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9780]
2012-01-02 18:13:16 -08:00
parrt ddb68aa948 new example
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9778]
2012-01-02 14:07:11 -08:00
sharwell 3d620734af Merging CL9604 to main (optimized string literals in generated code)
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9777]
2012-01-02 12:08:18 -08:00
parrt 353ddc6c2b using wrong map class
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9767]
2012-01-01 10:27:51 -08:00
parrt dff466be66 literal rules like A:'a' not seen in modes; weren't in .tokens files
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9766]
2011-12-31 17:26:48 -08:00
parrt a923ad8765 Major update to v4. I backed out a change I made on Christmas then mistakenly prevented any lexer DFA creation. Per http://www.antlr.org/wiki/display/~admin/2011/12/29/Flaw+in+ANTLR+v3+LL%28*%29+analysis+algorithm I fixed a major flaw in ANTLR's notion of context. To do that, I needed to create a new LoopEndState, with all of its fanout to the serialization and parser ATN construction. got a very good start on ParserATNPathFinder, which uses basic recursion to find all possible paths and return a tree with the possibilities. I left it in the condition where he would sometimes loop forever; it needs to track sets of configurations in the busy set; it using states at the moment. added a new signal from the interpreter: reportAttemptingFullContext. I fixed a bug where configuration sets derived from a configuration that had reachesIntoOuterContext>0 were not being considered as dipping into the outer context. The ambiguity checker needed to switch so that a check for exact matches not suffixes when doing full context. It's faster at the very least for full context. added some more support routines to DFA. Added TraceTree in support of the new ParserATNPathFinder.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9764]
2011-12-29 17:04:40 -08:00
parrt 3a3ed27e60 add some tests
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9763]
2011-12-28 19:49:37 -08:00
parrt 52396d8f5f removed method call
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9762]
2011-12-27 16:31:09 -08:00
parrt 9853061093 added null chk
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9759]
2011-12-27 14:32:19 -08:00
parrt 24c572d055 oops. antlr was ok, it was javalr grammar.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9754]
2011-12-26 17:14:29 -08:00
parrt 299c29d927 more lexer rule specialization in parser. got antlr almost back to working with new [Aa] notation in lexer.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9753]
2011-12-26 17:09:01 -08:00
parrt 3fae7cc880 rm unnecessary code
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9751]
2011-12-26 16:56:51 -08:00
parrt d9efffd104 Add [abc] syntax to allow set of char in lexer; args aren't allowed so unambig.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9750]
2011-12-26 15:58:40 -08:00
parrt 6fa5e52d5e added => skip, channel(99), more, mode(xx), push(xx), pop lexer syntax. separated lexer rules from others in parser / AST now.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9749]
2011-12-26 15:14:49 -08:00
parrt 6daa66f83f no more resolved bit in config. use ATNConfigSet all over. final clean up of ATN sim.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9741]
2011-12-25 12:01:24 -08:00
parrt bb48deb354 tweak to dotgenerator, make parserinterp using new atn sim
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9645]
2011-12-16 18:15:56 -08:00
parrt 6b673a3b2e track stats properly
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9643]
2011-12-16 16:00:11 -08:00
parrt ebd1fbb63d within 2 or 3 unit test of where I was before I got it the ATN simulator
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9642]
2011-12-16 15:07:28 -08:00
parrt 3d133e9417 broke out fullctx tests, some fixes.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9636]
2011-12-16 09:43:29 -08:00
parrt 1e8548297e mv comment over and make sure that the tree parsers use the new ATN engine
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9635]
2011-12-15 16:14:49 -08:00
parrt 5ad1505fdb almost got new ATN engine working; separated .* nongreedy tests, reorg args on reporting methods
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9627]
2011-12-15 11:03:41 -08:00
parrt 92279bd6db almost got prediction working
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9600]
2011-12-13 18:10:04 -08:00
parrt 3fb7466a80 another big reorg and fixed unit test. lots more sharing and splitting into methods; same 21/807 tests fail; java works.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9563]
2011-12-11 14:34:32 -08:00