Terence Parr
433a30c584
Merge pull request #2 from parrt/dev
...
added -trace to TestRig. fixed code gen issue for trace listener
2012-01-30 17:00:20 -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
09da63cfd4
rollback and do a real fix for whitespace escaping
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9911]
2012-01-27 12:00:30 -08:00
parrt
7498908d62
rollback and do a real fix for whitespace escaping
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9906]
2012-01-26 14:18:57 -08:00
parrt
adcf72b9a2
whitespace was being escaped to special characters even when printing to string should only do so when doing GUI tree
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9904]
2012-01-26 14:11:30 -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
9ffe9d2ee3
must have forgotten to commit
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9894]
2012-01-21 21:21:35 -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
093a4f951b
leave start/stop char index alone in CommonTokenFactory; refers to original text.
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9867]
2012-01-14 11:18:23 -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
5bd780c235
in tree views, spaces/newlines were blanks. I converted to \n and middle dot
...
for space.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9857]
2012-01-11 17:25:44 -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
b3c187e6c3
update changes
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9855]
2012-01-11 11:20:52 -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
cab41e41e3
had non-ascii char
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9812]
2012-01-04 09:05:31 -08:00
parrt
963ccd2700
added comment
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9797]
2012-01-03 12:46:51 -08:00
parrt
224a4bc9e1
changed formatting
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9796]
2012-01-03 12:46:39 -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
5c328c7e3f
Bug: didn't stop at end of stream during consume()
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9794]
2012-01-03 12:40:42 -08:00
parrt
1d6bbb08c3
kill
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9793]
2012-01-03 12:30:21 -08:00
parrt
5d60e85617
rm trace ATN state stuff. Will think about when we do debugging.
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9792]
2012-01-03 11:07:49 -08:00
parrt
c716a87544
move method down in file
...
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9791]
2012-01-03 11:05:40 -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