> Hi 
> 
> I am having trouble adding Lexer/Parser rules to a grammar that will deal 
> with quoted strings.
> 
> A phrase I would like to parse is:
> 
> create register FAULT_CODE initial value '301'
> 
> I am having trouble with the quoted string '301'.  When I build my AST, I 
> would like to have just the inner value, 301 passed, but when I tried to get 
> the text in my tree grammar, I get the full token with quotes, i.e. '301'.
> 
> This is a portion of my Parser/Lexer grammar where I am trying to define this.
> 
> stringValue
>       :       SINGLE_QUOTE! (~SINGLE_QUOTE|BACK_SLASH SINGLE_QUOTE)* 
> SINGLE_QUOTE!
>       ;
> 
> SINGLE_QUOTE
>       :       '\''
>       ;
> 
> BACK_SLASH
>       :       '\\'
>       ;
> 
> Everything works until I get into my Tree Grammar, and when I request the 
> text of the stringValue rule, I get the leading and trailing quotes, even 
> though there are not passed through to the Tree Grammar.
> 
> What am I doing wrong?  Is there a best practice for dealing with quoted 
> strings, and being able to escaped embedded quotes?
> 
> David Weiler-Thiessen
> Nestlé Purina PetCare
> phone: 306-933-0232
> cell: 306-291-9770
> 
> This e-mail, its electronic document attachments, and the contents of its 
> website linkages may contain confidential information.  This information is 
> intended solely for use by the individual or entity to whom it is addressed.  
> If you have received this information in error, please notify the sender 
> immediately and promptly destroy the material and any accompanying 
> attachments from your system.
> 
> 

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to