Hi Brian. I am newbie too. But i will try to answer the matter of question.
If you want to "grab" the values of the labels, you have to ways:
1) Assing each rule (lexel or parser) to a label, each label must be
have a diferent name (in order to use then later)
2) Assign a group of rules (lexer or parser) in a "list", that is: an
array of labels. So you doesn't have to use diferent names, and can have
the advantage of categorise same elements in an array for work with then
like an unit.
1)
author :l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR
It's isn't right, how do you select the second rule or the first rule.
So you must diferenciate:
author :l1=LTR l2=LTR ... ln=LTR
l1 is the first, l2 is the second.. and so on.
2)
You can do this:
author :l+=LTR l+=LTR l+=LTR l+=LTR l+=LTR l+=LTR l+=LTR l+=LTR l+=LTR
l+=LTR
{
$l[0] <--- is the first
$l[1] <--- is the second!.
// Sorry i don't know how to iterate through them.
It's target lenguaje specific the action part.
}
;
wELL, I HOPE, really i hope, you understand my explanation and help a
little!!.
Grettings!.
El 19/08/2010 12:56 p.m., Brian Lavender escribió:
> So, I have a parser rule that grabs 10 LTR lexer values. I would like to have
> the parser
> rule set its $text value to be the concatonation of these LTR values and put
> an
> XML tag around it.
>
> How do I do that?
>
> author : l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR l=LTR
> l=LTR
> {<Author>$l+</Author> };
>
> LTR : . ;
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.