[antlr-interest] NoViableAltException this time
Bart Kiers
bkiers at gmail.com
Thu Mar 25 05:56:14 PDT 2010
On Thu, Mar 25, 2010 at 1:27 PM, Simon zack <simonzack at gmail.com> wrote:
> tried using namespace_specification to interpret the string, but the error
> still shows up
>
> I changed the code a little, but a new exception pops up
>
> this only works when I remove the exception_info, however adding it messes
> up things
>
Both your first grammar:
exception_info
: '.exception'
;
namespace_specification
: ns_id1 = IDENTIFIER '.'
;
IDENTIFIER
: LETTER (LETTER|'0'..'9')*
;
LETTER
: '$'
| 'A'..'Z'
| 'a'..'z'
| '_'
;
and your second grammar:
exception_info
: '.exception'
;
namespace_specification
: ns_id1 = IDENTIFIER ('.' ns_idx = IDENTIFIER)*
//ns_id1 = IDENTIFIER ( '.' ns_idx = IDENTIFIER)*
;
IDENTIFIER
: LETTER (LETTER|'0'..'9')*
;
fragment LETTER
: '$'
| 'A'..'Z'
| 'a'..'z'
| '_'
;
interpret the string "hello.world" just fine. See the attached output of
ANTLRWorks v1.3.1.
Regards,
Bart.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.jpg
Type: image/jpeg
Size: 6426 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20100325/44ab5401/attachment.jpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.jpg
Type: image/jpeg
Size: 5577 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20100325/44ab5401/attachment-0001.jpg
More information about the antlr-interest
mailing list