On 03/09/2013 10:59 AM, Olivier Drevet wrote:
> When a rule is not defined in a wisent grammar, everythings after a line
> of code that is not handle is not parsed at all.
> reading from
> the line
> (stmnt (( error ?; )) ;; on error, skip until';' is read
> seems promising enough but I got no idea how to use it, and I was
> looking for a wisent grammar way to ignore tokens.
> does it have anything to do with semantic-lex-default-action ?
There are a couple ways to deal with errors in wisent. If you create an
iterative parser, you don't need to deal with error conditions.
Anything that doesn't parse is skipped, and it keeps trying starting at
the next lexical token.
It could be useful to handle errors inside some large construct, perhaps
in a class or something.
The cedet/semantic/wisent/java.wy parser handles errors. One example
looks like this:
: LBRACE enum_constants_opt enum_body_declarations_opt RBRACE
(nconc $2 $3)
| LBRACE error
;; On error, skip current block and try to continue.
As far as I can tell, the doc is referring to the Emacs Lisp format of
the compiled grammar. Not so useful I suppose. I personally haven't
done error recovery, but hopefully the java.wy examples will help.