Hi,

I have the two following rules :

codeBlock : stmt+=compoundStatement* -> ^(STMT $stmt)* ;

compoundStatement
        :
        (
                (       /* empty */
                        |       tryCatchBlock
                        |       localVarDecl
                        |       ifStatement
                        |       chooseCaseStatement
                        |       forStatement
                        |       loopStatement
                        |       embeddedSQL
                        |       singleStatement
                ) (Semi! | EOL! )
        )
        |       Label -> ^(LABEL Label)
        ;

As the compoundStatement can match empty lines or null statements
(like ;;;) my parser sometimes emit empty STMT nodes.
I cannot figure the correct way to conditionaly emit STMT if only the
compoundStatement is not empty.

I have tried something like codeBlock : stmt+=compoundStatement* ->
{$stmt.tree != null} ^(STMT $stmt)* ;
but because of the += notation the $stmt is a list and I did not find
yet the proper way to test each item.

Could you give me some help ?
-- 
Sébastien Kirche

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to