[antlr-interest] Magic problem

Johannes Luber jaluber at gmx.de
Fri Sep 7 03:20:04 PDT 2007


Mohammed Ibrahim wrote:
> Iam trying to parse GUID that is generated randomly by my application ,
> but you know the problem is that this Hash is generated beginning
> sometimes by numbers and sometimes by letters that is why i wrote this
> EBNF for it
>  
>  
> stat : r+;
> r  : ( LBL_CLIENT DOT NEW_GUID NEWLINE);
> NEW_GUID : MIXED ('-' MIXED)*;
> MIXED : ((LETTERS|INT))+;
> LETTERS : 'a'..'z'+;
> INT : '0'..'9'+;
> NEWLINE : '\r'?'\n';
> DOT : ':';
> LBL_CLIENT
>  : ('client_model'|'CLIENT_MODEL');
> WS : (' '|'\r'|'\n')+ { $channel = HIDDEN;};

Without sample GUIDs I can't test the grammar.

> I DON'T KNOW WHAT IS THE PROBLEM IT DOESN'T PARSE CORRECTLY , IN OTHER
> WINDOW IT PARSED CORRECTLY BUT IN MY MAIN APPLICATION GRAMMAR FILE ,IT
> DOESN'T WANT TO PARSE THE INPUT CORRECTLY.

This looks like as if you pulled those rules above from another grammar.
 The most likely source of error is that there is in that other grammar
a rule which also recognizes parts of the GUIDs and generates unexpected
tokens. Without having your entire grammar it isn't possible to confirm
this.

Best regards,
Johannes Luber


P.S.: Please don't use only capital letters in entire sentences.


More information about the antlr-interest mailing list