Hi Udo,

Ah yes, apologies: you can only reference parser rules like that:

parserRule : LexerRule { print($parserRule.text) } ;


and *not*:

LexerRule : OtherLexerRule { print($LexerRule.text) } ;


Regards,

Bart.


On Wed, Jul 13, 2011 at 10:27 PM, Udo Weik <weikeng...@aol.com> wrote:

> Hello again Bart,
>
>
>  `$text` is just a shorthand notation for `$XYZ.text` where `XYZ` is the
>> rule you're currently in.
>>
>
> $INTEGER.text doesn't work ("rule INTEGER has no defined parameters"), but
> your $text does.
> That's what I don't understand ;(.
>
>
>
> Many thanks and greetings
> Udo
>
>
>  On Wed, Jul 13, 2011 at 10:18 PM, Udo Weik <weikeng...@aol.com <mailto:
>> weikeng...@aol.com>> wrote:
>>
>>    Hello Bart and others,
>>
>>    yep, thanks, it works...
>>
>>
>>        Try:
>>
>>            INTEGER
>>               :  DIGIT+ { print($text) }
>>               ;
>>
>>
>>    1. Why do I not need the name, here INTEGER, like $INTEGER.text?
>>    2. With 12345 the result is
>>       L: (DIGIT): 1
>>       L: (DIGIT): 12
>>       L: (DIGIT): 123
>>       L: (DIGIT): 1234
>>       L: (DIGIT): 12345
>>       L: (INTEGER): 12345
>>
>>       I expected
>>       L: (DIGIT): 1
>>       L: (DIGIT): 2
>>       L: (DIGIT): 3
>>       L: (DIGIT): 4
>>       L: (DIGIT): 5
>>       L: (INTEGER): 12345
>>
>>
>>    Many thanks and greetings
>>    Udo
>>
>>
>>
>>        On Wed, Jul 13, 2011 at 9:57 PM, Udo Weik <weikeng...@aol.com<mailto:
>> weikeng...@aol.com> <mailto:weikeng...@aol.com <mailto:weikeng...@aol.com>>>
>> wrote:
>>
>>            Hello,
>>
>>            I just want to access the attributes of INTEGER
>>            and DIGIT - but how?
>>
>>            INTEGER: DIGIT+ { print( "L: (INTEGER): " ) } ;
>>
>>            fragment
>>            DIGIT: '0'..'9' { print( "L: (DIGIT): " ) } ;
>>
>>
>>            Thanks and greetings
>>            Udo
>>
>
>

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to