[antlr-interest] Comments / White-Space and All The Rest

Randall R Schulz rschulz at sonic.net
Fri Nov 24 11:57:53 PST 2006


Hi,

Here are the top-level rules for which I'd like to record intervening comments:

fofAnnotated
    :   'fof'
        '('
                name
            ',' formulaRole
            ',' firstOrderFormula
          ( ',' annotations ) ?
        ')'
        Period
        {
            acceptFOF($firstOrderFormula.fof, $name.n, $formulaRole.role);
        }
    ;


cnfAnnotated
    :   'cnf'
        '('
                name
            ',' formulaRole
            ',' clausalFormula
          ( ',' annotations ) ?
        ')'
        Period
        {
            acceptCNF($clausalFormula.cf, $name.n, $formulaRole.role);
        }
    ;


How would I modify them to get at the 'fof' or 'cnf' keyword token so I
can work backward and find any interstitial comments?


Thanks.

Randall Schulz


More information about the antlr-interest mailing list