[antlr-interest] Puzzled by leading dot

togol machillan togolmach2 at lycos.com
Tue Mar 15 08:31:08 PST 2005


Writing the dot as a separate character like '.' might solve the problem.

Mach


----- Original Message -----
From: "Juergen Weber" <weberjn at yahoo.com>
To: antlr-interest at antlr.org
Subject: [antlr-interest] Puzzled by leading dot
Date: Tue, 15 Mar 2005 07:58:00 -0800 (PST)

> 
> 
> Hi,
> 
> I want to parse lines of the form
> 
> .SE DATE = '03.02.2005';.SE TIME = '20:17'
> 
> 
> (basically a key value format, the .SE is to be
> ignored).
> 
> If I parse the input with the grammar below, I got
> this error message:
> 
> Exception in thread "main" line 1:1: unexpected char:
> '.'
> 
> How could I specify a keyword with a leading dot?
> 
> Thanks for your help,
> Juergen
> 
> 
> 
> 
> class MyParser extends Parser;
> 
> 
> line
> 	: item (SEMI item)*
> 	;
> 
> item
> 	: DOTSE IDENT "=" STRING_LITERAL
> 	;
> 
> 
> 
> class MyLexer extends Lexer;
> 
> tokens {
>          DOTSE=".SE";
> }
> 
> 
> IDENT
> 	:	('a'..'z'|'A'..'Z'|'_')
> ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
> 	;
> 
> 
> 
> STRING_LITERAL 	
> 	:
> 	'\''
> 	(~'\'')*
> 	'\''
> 	;
> 
> 
> SEMI:	';'
> 	;
> 
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/

-- 
_______________________________________________
NEW! Lycos Dating Search. The only place to search multiple dating sites at once.
http://datingsearch.lycos.com



More information about the antlr-interest mailing list