[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: sablecc3-beta-2 inlining bug



--- Begin Message ---
I've found a problem with the inlining. Namely I managed to create a structure
where a list is somehow duplicated and replaces another. So it parses
and compiles but the outputed AST is weird.

For full example see 

	http://www.mare.ee/indrek/tmp/bug-0.1.tar.gz

That archive also contains C# and C++ parsers if you're curious how they
look like.

More detailed description:

  statement {-> statement} =
     {if}                  [cs1]:l_par [i1]:if expr [ce1]:r_par statement* 
else_if? [cs2]:l_par end [i2]:if? [ce2]:r_par {-> New statement.if (expr, 
[statement], [else_if.statement]) }
  ;

  else_if {-> statement* } =
                            l_par else r_par statement* {-> 
[statement.statement]}
  ;

For some reason the first list of statements is overwritten by that
what comes from else_if. But when embedding the else_if
into the statmenet the problem goes away.

Whether else_if has ? after it or not doesn't seem to matter.

Regards,
Indrek

--- End Message ---