[antlr-interest] Problem with '.' character

Bertalan Fodor (LilyPondTool) lilypondtool at organum.hu
Wed Jan 23 08:03:02 PST 2008


Isn't it possible to write this:

var1=var2.var3=myTable.myField

With ANTLR 3, in this case I think LL(*) with backtracking should find 
its way, because the '=' sign will guide it.

Bert



Daniels, Troy (US SSA) wrote:
> Why is var2.var3 not a field expression?  Is it because they are on 
> different lines?  If so, you need to exclude newlines from your 
> ignored whitespace, and write the line-based rules as something like:
>  
> assignment: expr EQ expr NL;
>  
> rather than what I assume your current rule is:
>  
> assignment: expr EQ expr;
>  
> where NL matches whatever is allowed for newlines.
>  
> Troy
>  
>
>     ------------------------------------------------------------------------
>     *From:* antlr-interest-bounces at antlr.org
>     [mailto:antlr-interest-bounces at antlr.org] *On Behalf Of *Dev Team
>     *Sent:* Wednesday, January 23, 2008 10:30 AM
>     *To:* antlr-interest at antlr.org
>     *Subject:* [antlr-interest] Problem with '.' character
>
>     Hi there,
>     I am currently trying to write a grammar with antlr.
>     But the '.' character is used for both table/field separator and
>     statement ending.
>     here is an example :
>
>     |method public void myMethod() :
>     //...
>     var1 = var2.
>     var3 = myTable.myField.
>     //...
>     end method.
>     |
>     So, the problem is that the grammar considers 'var2.var3' as a
>     table/field expression.
>     Does someone know how to resolve this problem ?
>     thanks in advance
>


-- 
LilyPondTool is the editor for LilyPond files.
See http://lilypondtool.organum.hu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080123/2d6a25b7/attachment.html 


More information about the antlr-interest mailing list