What if you replace 'source' like this:
source : (statement)* EOF

Regards 
Philippe Frankson

-----Original Message-----
From: antlr-interest-boun...@antlr.org 
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Christoph Schinko
Sent: 09 March 2010 14:43
To: antlr-interest@antlr.org
Subject: [antlr-interest] Unexpected behavior - Error?

Hi!

Using the grammar below we experience unexpected behavior. The parser 
accepts the following input line:

<<<<<<< .mine

without throwing an error - which it should - according to the grammar. 
The grammar has been reduced to
a toy example reproducing the error. Any thoughts on that?

Regards, Chris

------------------------------------------------------------------------

grammar JScriptDoc;

options
{
     output=AST;
     backtrack=true;
     memoize=true;
}

source
     : (statement)*
     ;

statement
     : statementEmpty
     | statementBlock
     ;

statementBlock

     : '{' (statement )* '}'
     ;

statementEmpty
     : ';'
     ;

OPERATOR_LT
     : '<'
     ;

OPERATOR_DOT
     : '.'
     ;

IDENTIFIER
     : ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
      ;

NEWLINE
     : '\r'? '\n'
     {$channel=HIDDEN;}
         ;

WHITESPACE
     : ' '
     {$channel=HIDDEN;}
     ;

WHITETAB
     : '\t'
     {$channel=HIDDEN;}
     ;

-- 
Dipl.-Ing. Christoph Schinko       c.schi...@cgv.tugraz.at
Institute of Computer Graphics and Knowledge Visualization
Graz University of Technology      tel: +43 (316) 873-5416
Inffeldgasse 16c, 8010 Graz, Austria


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

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