-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,
I have a question about the "Mismatched input 'foo' expecting set null" error.

Here are the relevant parts of the grammar I am working on:

for_expr:       for_t space name (wspace in_t space word)? semiel do_t wspace 
list semiel done_t -> ^(for_t name (word)? list);
space   :       BLANK;
wspace  :       BLANK | EOL;
name    :       FILEPATH;
semiel  :       BLANK? (';' | EOL) BLANK?;

for_t   :       'for';
in_t    :       'in';
do_t    :       'do';
done_t  :       'done';
word    :       command_sub;

BLANK   :       (' '|'\t')+;
EOL     :       ('\r'?'\n') ;

fragment
FILENAME:       '"'(ALPHANUM|'.'|'-'|'_')(ALPHANUM|'.'|' '|'-'|'_')*'"'
        |       (ALPHANUM|'.'|'-'|'_')(ALPHANUM|'.'|'-'|'_')*;
FILEPATH:       '/'?FILENAME('/'FILENAME)*;

I'm testing my grammar with gunit, and I'm using the following input:

"for asdf; do
time cat; done" -> (for asdf (cat time))

This succeeds and does not fail the unit test.  However, if I give it the input

"for asdf; do
time cat
done" -> (for asdf (cat time))

I get the error:

test1 (for_expr, line4) - 
expected: (for asdf (cat time))
actual: line 3:0 mismatched input 'done' expecting set null

The debugger in ANTLRworks allows this input (I copied and pasted from the 
gunit file to the debugger input window) and shows the correct abstract syntax 
tree.  Everything  I've been able to find on the list so far has boiled down to 
white space which I've checked repeatedly.  What I cannot figure out is why 
changing the one character makes a difference.

Is there something obvious that I am doing wrong?  I'm still fairly new to 
ANTLR, and this is a very ambitious project, so any help would be greatly 
appreciated.

Thanks,
Nathan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iEYEARECAAYFAkwP97EACgkQFpoRlVgtqKavdgCfWgzlGBMHz0rguJLd4PRt9vyH
r5UAn3RC8oSjERRkO0kwhK6hkCowFrUW
=bLYD
-----END PGP SIGNATURE-----

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.

Reply via email to