meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
lookbehind [2020/09/25 11:54] revuskycontextual_predicates [2021/02/08 18:09] – ↷ Page name changed from lookbehind to contextual_predicates revusky
Line 67: Line 67:
 ==== Summary ==== ==== Summary ====
  
-A //lookbehind predicate// starts optionally with a tilde "~" to indicate negation. The first character after the tilde (or simply the first character if there is no tilde) must be either a backslash or a forward slash. The backslash indicates that we are scanning backwards from the current production and the forward slash is that we are scanning forward from the current production.+A //lookbehind predicate// starts optionally with a tilde "~" to indicate negation. The first character after the tilde (or simply the first character if there is no tilde) must be either a backslash or a forward slash. The backslash indicates that we are scanning backwards from the current production and the forward slash means that we are scanning forward from the current production.
  
 An ellipsis "..." means that we can have an arbitrary number (including zero) of intervening productions. A dot "." means that we have exactly one production of any type.  An ellipsis "..." means that we can have an arbitrary number (including zero) of intervening productions. A dot "." means that we have exactly one production of any type. 
Line 87: Line 87:
 In the above we specify that Foo must be //non-reentrant// and also that the next 2 tokens must be "bar" followed by "baz", or else we jump out of the loop. In the above we specify that Foo must be //non-reentrant// and also that the next 2 tokens must be "bar" followed by "baz", or else we jump out of the loop.
  
-NB. If you have a ''SCAN'' statement that does not specify either numerical or syntactic lookahead, then the generated code will scan ahead an //unlimited// number of tokens. (Unless the expansion to be parsed is constrained by an [[up-to-here]] marker.) This is a key characteristic of the newer [[scan statement]].+NB. If you have a ''SCAN'' statement that does not specify either numerical or syntactic lookahead, then the generated code will scan ahead an //unlimited// number of tokens. (Unless the expansion to be parsed is constrained by an [[up to here]] marker.) This is a key characteristic of the newer [[scan statement]].
  
 Note also that //lookbehind predicates//, like syntactic lookahead in JavaCC 21, can be nested arbitrarily and work in an arbitrarily nested scanahead routine. Note also that //lookbehind predicates//, like syntactic lookahead in JavaCC 21, can be nested arbitrarily and work in an arbitrarily nested scanahead routine.