Problem of using Nongreedy Subrules
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, April 1, 2002 08:33 PM

I tried to test Nongreedy Subrules under ANTLR v2.7.1, onto a C-style comment. The compilation was successful, but I kept receiving runtime error. Can someone give me a hint? Here is the runtime error message: Exception: antlr.TokenStreamRecognitionException: expecting '*', found ' ' Input test data: /* BA */ Most importantly, the grammar code(.g): header { import java.io.*; import java.util.*; } class P extends Parser; startRule : n:COMMENT_BLOCK ; class L extends Lexer; options {    More>>


			
I tried to test Nongreedy Subrules under ANTLR v2.7.1, onto a C-style comment. The compilation was successful, but I kept receiving runtime error. Can someone give me a hint?



Here is the runtime error message:

			
Exception: antlr.TokenStreamRecognitionException: expecting '*', found ' '



Input test data:

			
/* BA */



Most importantly, the grammar code(.g):

header {
import java.io.*;
import java.util.*;
}

class P extends Parser;

startRule
:
n:COMMENT_BLOCK
;

class L extends Lexer;
options {
k=2;
}

COMMENT_BLOCK
: "/*"
(
options {
greedy=false;
}
: .
)*
"*/"
{ System.out.println($getText); }
;



Thanks for the help in advance!

   <<Less

Re: Problem of using Nongreedy Subrules

Posted By:   Monty_Zukowski  
Posted On:   Wednesday, April 3, 2002 06:02 AM

About | Sitemap | Contact