[antlr-interest] Bug? Invalid Java code generated

Jim Idle jimi at temporal-wave.com
Fri Mar 6 09:56:32 PST 2009


Sam Barnett-Cormack wrote:
> Jim Idle wrote:
>> Sam Barnett-Cormack wrote:
>>> Hi all
>>>
>>> The attached grammar (which you're probably all tired of) generates 
>>> Java code with an error in. I've checked, and the error isn't in a 
>>> copy action or predicate - it's in the expansion of $text in a 
>>> parser predicate. I don't know if I've used $text incorrectly,
>>
>> Here is a hint. $text of what? This is a parser rule not a lexer rule.
>
> "The Definitive ANTLR Reference", Terence Parr, p130: Figure 6.2, 
> Predefined Parser Rule Attributes:
>
> "Attribute: text
> Type: String
> Description: The text matched from the start of the rule up until the 
> point of the $text expression evaluation..."
>
Oh, well you obviously already know everything already then.

Jim


More information about the antlr-interest mailing list