Re: [cedet-semantic] {Spam?} Re: state in parsers
Brought to you by:
zappo
From: David E. <de...@ra...> - 2015-12-15 19:49:17
|
Kristof Bastiaensen writes: > Can the lexer be controlled from the parser, or are they > totally separated? Can I modify lexer state from the parser? > Is that such a hard question? It is. The lexer and the parser are separated. But since this is Emacs Lisp, nothing really is 'totally' separate. Since you can call pretty much any Emacs Lisp code in your actions, you are free to set some variable there which affects how your lexers work. The LL parser (Bovine) does something similar with the EXPAND/EXPANDFULL actions, which incrementing a 'depth' variable and call the parser recursively. This variable defines the depth with which the lexers should look into '{}' and '()' blocks (otherwise they simply return a 'semantic-list' token). AFAIK, the Wisent parser does not support this out of the box, but you should be able to cook up something similar, but maybe you have to dig into the Wisent code a bit to get this right. Sorry I cannot give you a better answer. -David |