}
}
void Coco() {
int beg, end;
ATGSegment imports=null, ignores=null, comments=null;
ATGSegment settings, productions;
ATGSegment group, child;
String str0, attribs;
if (StartOf(1)) {
Get();
beg = t.pos;
while (StartOf(1)) {
Get();
}
imports = new ATGSegment(SECTION_IMPORTS, beg, la.pos-1);
}
Expect(6);
beg = t.pos;
Expect(1);
fRoot = new ATGSegment(SECTION_COMPILER, t.val, beg);
settings = new ATGSegment(SECTION_SCANNER);
if (imports != null) fRoot.addChild(imports);
beg = end = la.pos;
while (StartOf(2)) {
Get();
end = t.pos + t.val.length();
}
if (end > beg) fRoot.addChild(new ATGSegment(SECTION_CODE, beg, end));
if (la.kind == 7) {
Get();
settings.addChild(new ATGSegment(GROUP_IGNORECASE, t.pos, t.pos + t.val.length()));
}
if (la.kind == 8) {
Get();
group = new ATGSegment(GROUP_CHARACTERS, t.pos);
while (la.kind == 1) {
SetDecl(group);
}
group.setEndPoint(t.pos + t.val.length()); settings.addChild(group);
}
if (la.kind == 9) {
Get();
group = new ATGSegment(GROUP_TOKENS, t.pos);
while (la.kind == 1 || la.kind == 3 || la.kind == 5) {
TokenDecl(group);
}
group.setEndPoint(t.pos + t.val.length()); settings.addChild(group);
}
if (la.kind == 10) {
Get();
group = new ATGSegment(GROUP_PRAGMAS, t.pos);
while (la.kind == 1 || la.kind == 3 || la.kind == 5) {
TokenDecl(group);
}
group.setEndPoint(t.pos + t.val.length()); settings.addChild(group);
}
while (la.kind == 11) {
Get();
beg = t.pos;
if (comments == null) comments = new ATGSegment(GROUP_COMMENTS, beg);
Expect(12);
TokenExpr();
str0 = "FROM " + t.val +" TO ";
Expect(13);
TokenExpr();
str0 += t.val;
if (la.kind == 14) {
Get();
str0 += " (NESTED)";
}
comments.addChild(new ATGSegment(ITEM_COMMENT, str0, beg, t.pos + t.val.length()));
comments.setEndPoint(t.pos + t.val.length());
}
if (comments!=null) settings.addChild(comments);
while (la.kind == 15) {
Get();
beg = t.pos;
if (ignores==null) ignores = new ATGSegment(GROUP_IGNORE, t.pos);
str0 = Set();
ignores.setEndPoint(t.pos + t.val.length());
ignores.addChild(new ATGSegment(ITEM_IGNORE, str0, beg, t.pos + t.val.length()));
}
if (ignores!=null) settings.addChild(ignores);
settings.setEndPoint(t.pos + t.val.length());
while (!(la.kind == 0 || la.kind == 16)) {SynErr(45); Get();}
Expect(16);
fRoot.addChild(settings);
productions = new ATGSegment(SECTION_PRODUCTIONS, t.pos);
fRoot.addChild(productions);
while (la.kind == 1) {
Get();
beg = t.pos; str0 = t.val; attribs = null;
if (la.kind == 24 || la.kind == 29) {
attribs = AttrDecl();
attribs = "<" + attribs + ">";
}
if (la.kind == 42) {
SemText();
}
ExpectWeak(17, 3);
Expression();
ExpectWeak(18, 4);
child = new ATGSegment(ITEM_PRODUCTION, str0, beg, t.pos + t.val.length());
if (attribs != null) child.setAttributes(attribs);
productions.addChild(child);
}
productions.setEndPoint(t.pos + t.val.length());