[antlr-interest] In C how do I determine if a parameter is present

Jeffrey Newman jeffn at photorepo.com
Fri Dec 31 16:52:20 PST 2010


Hi,
I'm trying to determine if db is present.
I have not figured out how to do this.
The java exmple in the book (like I have below) says missing an attribute.
I tired text and it faults (start is invalid).

Some body please help.

thanks

Jeffrey



// DROP TABLE
drop_table_stmt
    : ^(DROP_TABLE ^(OPTIONS EXISTS?) ^(table = id db = id?))

        {
        	if ($db == 0) {
        		sprintf(buffer, "Walker: Drop Table (table name: \%s",
        						 $table.text->chars);
			}        						 
			else {         					
        		sprintf(buffer, "Walker: Drop Table (table name: \%s db 
name: \%s",
        						 $table.text->chars, $db.text->chars);
     		}
            debug(buffer);
        }    
    ;


More information about the antlr-interest mailing list