Hi Fabien,
It's not possible to do this directly, but it's very easy to do with the
following trick:
1) define dummy start tokens, one for each entry point, e.g.
...
Tokens,
start_xxx = ;
start_yyy = ;
id = letter (letter | digit)*;
...
2) Use the dummy tokens to start the alternatives of an "entry_point"
main production, e.g.
entry_point =
{xxx} start_xxx xxx |
{yyy} start_yyy yyy;
xxx = ...
...
3) Define a custom lexer that injects in initial start token in the
token stream to select the appropriate entry point, e.g.
class CustomLexer extends Lexer {... new TStartXxx() ... new TStartYyy()
...}
Have fun!
Etienne
Etienne Gagnon, Ph.D.
http://sablecc.org