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