Parser hangs detecting EOF
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mel_Rosenberg
Posted On:   Friday, December 31, 2004 02:23 PM

I am trying to detect the pattern Number Space Word Number It works until it encounters the end of file, then the Java code hangs on if (((LA(1)==Num))) . Below is an excerpt of code. any ideas why this happens? class FullFormParser extends Parser; parseXml returns [List values = null] : ( values = parSent )+ EOF ; parSent returns [List values= new LinkedList()] {String w="";} : ( ( Num WS alphaNumDot WS Num) => w=vNumRepPNum class FullFormLexer extends Lexer; options { k=2; // needed for newline junk    More>>

I am trying to detect the pattern Number Space Word Number




It works until it encounters the end of file, then the Java code hangs on if (((LA(1)==Num))) .


Below is an excerpt of code. any ideas why this happens?



class FullFormParser extends Parser;




parseXml returns [List values = null]
: ( values = parSent )+ EOF ;


parSent returns [List values= new LinkedList()]

{String w="";}

: ( ( Num WS alphaNumDot WS Num) => w=vNumRepPNum



class FullFormLexer extends Lexer;


options {

k=2; // needed for newline junk

charVocabulary='u0000'..'u007F'; // allow ascii
}


WS : ( ' ' | ' ' )+ ;


Num : ('0'..'9')+ ;


thanks
Mel

   <<Less
About | Sitemap | Contact