[antlr-interest] [C target] how to skip empty lines
William B. Clodius
wclodius at los-alamos.net
Fri Oct 23 21:14:08 PDT 2009
On Oct 22, 2009, at 11:31 PM, Юрушкин Михаил wrote:
> David-Sarah Hopwood <david-sarah at jacaranda.org> писал(а) в
> своём письме Fri, 23 Oct 2009 09:20:32 +0400:
>> Юрушкин Михаил wrote:>> first example: stmnt <\n> stmnt
>> <\n> stmnt <;> <\n> // i mean <\n> is>> enough to seperate
>> >> For most languages that do that, it's sufficient to add an
>> empty > statement> rule in the parser.
> mm.. empty lines can be in every place of grammar: between
> statements, procedures, declarations etc where empty_statement rule
> isn't exist.I think it's important to skip redudant <\n> on lexer
> level... but i don't know how to do that clearly (without
> overriding nextToken for example).
> -- Best regards,Michael
> List: http://www.antlr.org/mailman/listinfo/antlr-
> interestUnsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
FWIW Fortran handles this by defining empty lines to be comments so
they are normally discarded with other comments or whitespace.
More information about the antlr-interest