non terminal ParseNode intface, methlist, meth, paramlist, param, paramtype;
non terminal ParseNode capablist, capab, capabcont, cont;
non terminal ParseNode reqlist, require, capintlist;
-non terminal ParseNode enumdec, enumlist, enummem;
-non terminal ParseNode structdec, structlist, structmem;
+non terminal ParseNode enumdeclist, enumdec, enumlist, enummem;
+non terminal ParseNode structdeclist, structdec, structlist, structmem;
/**
pn.addChild(rl);
RESULT = pn;
:}
- | enumdec:en
- {:
- ParseNode pn = new ParseNode("policy");
- pn.addChild(en);
- RESULT = pn;
- :}
- | structdec:st
- {:
- ParseNode pn = new ParseNode("policy");
- pn.addChild(st);
- RESULT = pn;
- :}
;
//1) Interface class definition
// 3) Driver list
// Interface
-intface ::= PUBLIC INTERFACE IDENT:idint BEGIN methlist:ml capablist:cl END
+intface ::= PUBLIC INTERFACE IDENT:idint BEGIN methlist:ml capablist:cl enumdeclist:el structdeclist:sl END
{:
ParseNode pn = new ParseNode("interface");
pn.addChild("intface_ident").setLiteral(idint);
pn.addChild(ml);
pn.addChild(cl);
+ pn.addChild(el);
+ pn.addChild(sl);
RESULT = pn;
:}
;
:}
;
-//4) Enumeration declaration
+//4) Enumeration declaration list
+enumdeclist ::= enumdeclist:el enumdec:ed
+ {:
+ el.addChild(ed);
+ RESULT = el;
+ :}
+ | /* empty */
+ {:
+ ParseNode pn = new ParseNode("enum_dec_list");
+ RESULT = pn;
+ :}
+ ;
enumdec ::= ENUM IDENT:idenumdec BEGIN enumlist:el END
{:
ParseNode pn = new ParseNode("enum_dec");
pn.addChild(el);
RESULT = pn;
:}
- ;
+ ;
enumlist ::= enumlist:el enummem:e
{:
el.addChild(e);
:}
;
-//5) Struct declaration
+//5) Struct declaration list
+structdeclist ::= structdeclist:sl structdec:sd
+ {:
+ sl.addChild(sd);
+ RESULT = sl;
+ :}
+ | /* empty */
+ {:
+ ParseNode pn = new ParseNode("struct_dec_list");
+ RESULT = pn;
+ :}
+ ;
structdec ::= STRUCT IDENT:idstructdec BEGIN structlist:sl END
{:
ParseNode pn = new ParseNode("struct_dec");
:}
| /* empty */
{:
- ParseNode pn = new ParseNode("enum_list");
+ ParseNode pn = new ParseNode("struct_list");
RESULT = pn;
:}
;