Completing parser to parse generic/template return types; adding standard method...
[iot2.git] / others / javacup / iotparser.cup
index be96c46279e9c48ccbffd9c8d6bf4887bfc53c41..00db795902a1743a441e2d75014cff7563fdbd4c 100644 (file)
@@ -121,6 +121,23 @@ meth       ::= PUBLIC TYPE:typemeth IDENT:idmeth LPAR paramlist:pl RPAR SEMICOLO
                pn.addChild(pl);
                RESULT = pn;
        :}
+       /* generic/template return value with one type, e.g. set<int> */
+    | PUBLIC IDENT:clsmeth LANG TYPE:typegen RANG IDENT:idmeth LPAR paramlist:pl RPAR SEMICOLON
+       {:
+               ParseNode pn = new ParseNode("method");
+               pn.addChild("method_class").setLiteral((String)clsmeth + "<" + typegen + ">");
+               pn.addChild("method_ident").setLiteral(idmeth);
+               pn.addChild(pl);
+               RESULT = pn;
+       :}
+    | PUBLIC IDENT:clsmeth LANG IDENT:clsgen RANG IDENT:idmeth LPAR paramlist:pl RPAR SEMICOLON
+       {:
+               ParseNode pn = new ParseNode("method");
+               pn.addChild("method_class").setLiteral((String)clsmeth + "<" + clsgen + ">");
+               pn.addChild("method_ident").setLiteral(idmeth);
+               pn.addChild(pl);
+               RESULT = pn;
+       :}
     ;
 paramlist  ::= paramlist:pl param:p
        {:
@@ -161,7 +178,7 @@ param      ::= TYPE:typeprm IDENT:idprm COMMA
                pn.addChild("param_ident").setLiteral(idprm);
                RESULT = pn;
        :}
-       /* generic/template with one type, e.g. list<int> */
+       /* generic/template with one type, e.g. set<int> */
     | IDENT:clsprm LANG TYPE:typegen RANG IDENT:idprm
        {:
                ParseNode pn = new ParseNode("param");
@@ -177,7 +194,7 @@ param      ::= TYPE:typeprm IDENT:idprm COMMA
                RESULT = pn;
        :}
        /* Add comma at the end... */
-       /* generic/template with one type, e.g. list<int> */
+       /* generic/template with one type, e.g. set<int> */
     | IDENT:clsprm LANG TYPE:typegen RANG IDENT:idprm COMMA
        {:
                ParseNode pn = new ParseNode("param");