Sam Barnett-Cormack wrote:
> Jim Idle wrote:
>> 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.
> 
> All I'm saying is that the docs say it can be used in a parser rule. And 
> that I know what its value should be. There's no need to assume I've 
> done something stupid, which certainly seems to be the case when you 
> suggest that using $text there isn't valid, or is problematic in some 
> way, without elaborating, especially when the docs say it can be used.

Of course, it might just be that I missed something in reading the docs, 
like the fact that rule attributes are reached as ruleName.$attribute, 
not just $attribute... although that only seems to be mentioned 
implicity, in an example... and it does generate some code that would 
appear to work if the code were in the rule function, rather than 
separated into a predicate function. So it's a confusing situation.

-- 
Sam Barnett-Cormack

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

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

Reply via email to