[antlr-interest] what is a problem with following grammer
    sachin_sawant10 
    sachin_sawant10 at yahoo.com
       
    Fri May 24 04:44:30 PDT 2002
    
    
  
My grammer file is as follows,
---------------------------------------------------------------------
class JSPParser extends Parser;
file:   (statement)+ 
	;
statement: (   WORD
             | STRING
	     | link
      )
	;
link    :		
                LINKSTART
		IMG
		LINEND
	
	;
class JSPLexer extends Lexer;
options {
	caseSensitive=false;
	k=7;
	filter=SCARF;
	charVocabulary='\3'..'\177';
}
LINKSTART
	:	"<i18n:link" 
		(WS (ATTR)*)?     
		">"		
	;
IMG    
        :      	"<i18n:img" 
		(WS (ATTR)*)?       
		"/>"		
	;
LINKEND
	:	"</i18n:link>" 
	;
protected
ATTR
options {
	ignore=WS;
}
	:	w:WORD '='
		(	s:STRING
		|	v:WORD
		)
	;
/** Match until next whitespace; can be file, int, etc... */
protected
WORD:	(
			options {
				generateAmbigWarnings=false;
			}
		:	'a'..'z' | '0'..'9' | '/' | '.' | '#' | '_'
		)+
	;
protected
STRING
	:	'"' (~'"')* '"'
	|	'\'' (~'\'')* '\''
	;
protected
WS	:	(	' '
		|	'\t'
		|	'\f'
		|	(	"\r\n"  // DOS
			|	'\r'    // Macintosh
			|	'\n'    // Unix (the right way)
			)
			{ newline(); }
		)
		
	;
protected
SCARF
	:	WS	// track line numbers while you scarf
	|	.
	;
--------------------------------------------------------------------
When I run the parser.file() on the following data
<i18n:link 
page="/aggregationServlet/app/aggregation/user/toViewAccount">
     <i18n:bean pageProperty="buttonCancelImage" border="0" 
altProperty="buttonCancelText" />
</i18n:link>
I get "line 3: expecting IMG, found '</i18n:link>'" error.
Could anybody help me to solve this issue?
Thanks
Sachin
 
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
    
    
More information about the antlr-interest
mailing list