[antlr-interest] Problem with a simple grammar

Ric Klaren klaren at cs.utwente.nl
Mon Nov 11 01:42:26 PST 2002


On Mon, Nov 11, 2002 at 09:34:11AM +0100, Hrvoje Nezic wrote:
> I get the following error:
> 
>     line 1:1: unexpected char: 'p'

Your lexer has no rule to match identifiers.

ID options { testLiterals=true; } : 
	('a'..'z'|'A'..'Z'|'_')('a'..'z'|'A'..'Z'|'_'|DIGIT)*
;

If you have things in one file adding the above rule (or something similar)
will probably make things work. The testLiterals option lets antlr check
for matches in the literals table (e.g. the private etc.) In the global
options you can then turn testLiterals off since they will only get matched
in the ID rule.

HTH,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
 'And this 'rebooting' business? Give it a good kicking, do you?' 'Oh, no,
  of course, we ... that is ... well, yes, in fact,' said Ponder. 'Adrian
    goes round the back and ... er ... prods it with his foot. But in a
     technical way,' he added. --- From: Hogfather by Terry Pratchett.


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list