[antlr-interest] Unexpected Token problem

Meena Moktali mmoktali at bphx.dk
Tue Mar 22 03:35:24 PST 2005


hi all,
I have a problem with Tree construction.
I have written a grammar for parsing map statements which are as shown below

----------------------------------------------------------------
map CURRENCY_SPACE in KSPS4_MSG
       to TEXT_CODE of STD_MSG_PARM_V of STD_MSG_CLIENT_SRV_I
map 'CURRENCY_EXCHANGE'
       to VIEW_LONG_NAME of STD_MSG_CLIENT_SRV_I
---------------------------------------------------------------- 

The grammar Lexer and Parser are as below....

***************************************************************
class MapsParser extends Parser;

options{buildAST=true;}

statement	:	(mapval)+ ;

mapval	:	"map"^ viewfield "to" viewfield ;

viewfield	:	text((IN^|OF^)text)*;

text	 	:	IDENT ;

class MapsLexer extends Lexer;

options{k=2;}

IDENT	:	('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'\'')(WS)* ;

WS	:	('\t'
		|'\r''\n' {newline();}
		|'\n'	  {newline();}
		|'\r'
		|' ');
IN	:	"in" ;
OF	:	"of" ;

**************************************************************
What is the problem with the parser?
I am getting an error

C:\TEMP>java MapMain
line 1:1: unexpected token: m
Exception java.lang.NullPointerException

PLease help.....

-Meena.

-----Original Message-----
From: Scott Stanchfield [mailto:scott at javadude.com]
Sent: 21. marts 2005 15:03
To: antlr-interest at antlr.org
Subject: RE: [antlr-interest] Re: ANTLR GUI name



More information about the antlr-interest mailing list