meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
up_to_here [2020/09/26 16:57] – [Niggles (Annoying Details)] revusky | up_to_here [2023/03/03 14:26] (current) – revusky | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== The " | + | ===== The " |
- | The // | + | The // |
Where in legacy JavaCC, you would write: | Where in legacy JavaCC, you would write: | ||
Line 9: | Line 9: | ||
</ | </ | ||
- | or in JavaCC 21 (//without up-to-here// | + | or in CongoCC |
< | < | ||
Line 45: | Line 45: | ||
</ | </ | ||
- | (I refer to these as //simple// because both of them are just a sequence of three string literal tokens. | + | (I refer to these as //simple// because both of them are just a sequence of three string literal tokens. |
Suppose further that we have a choice construct: | Suppose further that we have a choice construct: | ||
Line 53: | Line 53: | ||
</ | </ | ||
- | Now, if no '' | + | Now, if no '' |
The classic solution would be to specify two tokens of lookahead, so that we need to match " | The classic solution would be to specify two tokens of lookahead, so that we need to match " | ||
Line 61: | Line 61: | ||
</ | </ | ||
- | In JavaCC 21, you have the option of putting an // | + | In CongoCC, you have the option of putting an // |
< | < | ||
Line 67: | Line 67: | ||
</ | </ | ||
- | This means that we scan up to (and including) the " | + | This means that we scan up to (and including) the " |
Now, the choice construct above can be written simply as: | Now, the choice construct above can be written simply as: | ||
Line 153: | Line 153: | ||
Though it could conceivably be anti-intuitive (I'm not sure really...) the // | Though it could conceivably be anti-intuitive (I'm not sure really...) the // | ||
- | | + | |
+ | Note also that the only //nested// up-to-here that applies to an expansion is in a NonTerminal that //starts// the expansion. Thus, if we have the expansion: | ||
+ | |||
+ | < | ||
+ | ( Foo Bar Baz )* | ||
+ | </ | ||
+ | |||
+ | The // | ||
+ | |||
+ | < | ||
+ | ( Foo =>|+2 Bar Baz )* | ||
+ | </ | ||
+ | |||
+ | As of this writing, there is no way to get the lookahead machinery to respect the // | ||
+ | |||
+ | < | ||
+ | | ||
+ | </ | ||
+ | |||
+ | What the above means is that we scan to the end of the < | ||