[antlr-interest] Not Matching
Quintin Beukes
quintin.beukes at signio.co.za
Thu Feb 9 04:43:16 PST 2012
Just thought I'd mention that the problem was input.txt being
UTF-16LE, and I didn't provide for that at this time.
Quintin Beukes
On Thu, Feb 9, 2012 at 12:20 PM, Quintin Beukes
<quintin.beukes at signio.co.za> wrote:
> Hi,
>
> I've been playing around with ANTLR 3.3 and am trying to match a very
> simple input with a very simple grammar, though I keep getting this
> error:
> input.txt line 1:0 missing 'OnChange:' at ''
>
> What am I doing wrong?
>
> The input.txt file:
> OnChange:
>
> The grammar:
> grammar TestGrammar;
>
> @members {
> public static void main(String[] args) throws Exception {
> TestGrammarLexer lex = new TestGrammarLexer(new ANTLRFileStream(args[0]));
> CommonTokenStream tokens = new CommonTokenStream(lex);
>
> TestGrammarParser parser = new TestGrammarParser(tokens);
>
> try {
> parser.fieldRules();
> } catch (RecognitionException e) {
> e.printStackTrace();
> }
> }
> }
>
> fieldRules
> : 'OnChange:' WS
> ;
>
> WS
> : ('\t' | ' ' | '\n' | '\r')*
> ;
>
>
> Quintin Beukes
More information about the antlr-interest
mailing list