[antlr-interest] Question about using Nongreedy Subrules
spenserkao
spenserkao at optushome.com.au
Tue Apr 2 06:47:11 PST 2002
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? Thanks for any help in
advance!
--- Start of Runtime error message ---
Exception: antlr.TokenStreamRecognitionException: expecting '*',
found ' '
--- End of Runtime error message ---
--- Start of Input test data ---
/* BA */
--- End of Input test data ---
--- Start of 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); }
;
--- End of grammar code(.g) ---
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list