When parsing the following data
"2 CORP The Church of Jesus Christ of Latter-day Saints"
The parser is choking on Ch? and striping it out.
line 1:12 mismatched character 'h' expecting 'O'
line 1:28 mismatched character 'h' expecting 'O'
Data: Theurch of Jesusrist of Latter-day Saints
I am new to antlr, is my grammer wrong, or is it a bug?
Grammer -
grammar Test1 ;
test1 : NUMBER ' CORP ' data {System.out.println("Data: " +
$data.text);} ;
data : ~('\r' | '\n')* ;
NUMBER : '0'..'9'+ ;
OTHERCHAR :
'~' |
'!' |
'@' |
'#' |
'$' |
'%' |
'^' |
'&' |
'*' |
'(' |
')' |
'-' |
'_' |
'+' |
'=' |
'{' |
'}' |
'[' |
']' |
':' |
';' |
'<' |
'>' |
'?' |
',' |
'.' |
'/' |
' ' ;
WORD : ('a'..'z' | 'A'..'Z')+ ;
Test App -
import java.io.IOException;
import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
public class TestApp
{
public static void main(String[] inArgList)
{
try
{
ANTLRFileStream theFileStream = new
ANTLRFileStream("/home/glenmiller/tmp1/output/TestData2");
Test1Lexer theLexer = new Test1Lexer(theFileStream);
CommonTokenStream theTokenStream = new
CommonTokenStream(theLexer);
Test1Parser theParser = new Test1Parser(theTokenStream);
theParser.test1();
}
catch (IOException inException)
{
inException.printStackTrace();
}
catch (RecognitionException inException)
{
inException.printStackTrace();
}
}
}
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---