meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
up_to_here [2020/09/25 18:25] – revusky | up_to_here [2020/12/23 10:09] – [The up-to-here marker in parsing productions] revusky | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== The " | + | ===== The " |
- | The // | + | The // |
Where in legacy JavaCC, you would write: | Where in legacy JavaCC, you would write: | ||
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 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 116: | Line 116: | ||
The above basically summarizes how the new // | The above basically summarizes how the new // | ||
* If an expansion has an // | * If an expansion has an // | ||
- | * If an expansion has an explicit // | + | * If an expansion has an explicit // |
What this means, for example, is that if we have: | What this means, for example, is that if we have: | ||
Line 124: | Line 124: | ||
</ | </ | ||
- | then any // | + | then any // |
By the same token, if we specify a specific numerical limit, then that overrides any nested // | By the same token, if we specify a specific numerical limit, then that overrides any nested // | ||
Line 152: | Line 152: | ||
</ | </ | ||
- | 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 < | ||