How do I get an iterator for the one or more? The following doesn't quite seem
to work.
grammar Agenda;
options {language='Java';}
agenda :
l1=bill+ { Iterator it = $l1.iterator() ; } ;
bill returns[String xml] :
active fiscal title author NL
subject NL NL {
$xml = "<BILL>\n";
$xml += $title.xml + "\n";
$xml += $author.xml + "\n";
$xml += $subject.xml + "\n";
$xml += "</flag type=\"active\" status=\"" + $active.text +
"\">\n";
$xml += "</flag type=\"fiscal\" status=\"" + $fiscal.text +
"\">\n";
$xml += "</BILL>\n";
}
;
title returns [String xml] :
fifteen {
$xml="<Title>" + $fifteen.text + "</Title>";
};
author returns [String xml] :
ten {
$xml="<Author>" + $ten.text + "</Author>";
};
subject returns [String xml] :
ten {
$xml="<Subject>" + $ten.text + "</Subject>";
};
active : FLAG;
fiscal : FLAG;
fifteen : LTR LTR LTR LTR LTR LTR LTR LTR LTR LTR LTR LTR LTR LTR LTR;
ten : LTR LTR LTR LTR LTR LTR LTR LTR LTR LTR;
NL : ('\n'|'\r'|'\r\n');
FLAG : ('Y'|'N');
LTR : . ;
Input to the Lexer/Parser is the following.
YYconstruct bill frank burn
Make lifez
YYeazememnt bill billy bob
roughlife
--
Brian Lavender
http://www.brie.com/brian/
"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."
Professor C. A. R. Hoare
The 1980 Turing award lecture
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.