Adding handling for primitives, non-primitives, and user-defined types; doesn't handl...
authorrtrimana <rtrimana@uci.edu>
Thu, 29 Sep 2016 21:17:05 +0000 (14:17 -0700)
committerrtrimana <rtrimana@uci.edu>
Thu, 29 Sep 2016 21:17:05 +0000 (14:17 -0700)
config/iotpolicy/policy.pol
iotjava/Makefile
iotjava/iotpolicy/IoTCompiler.java
iotjava/iotpolicy/parser/Lexer.java
iotjava/iotpolicy/parser/Parser.java
iotjava/iotpolicy/parser/sym.java
iotjava/iotpolicy/tree/InterfaceDecl.java
others/javacup/iotparser.cup
others/jflex/iotparser.jflex

index 3048c1e..986f6f9 100644 (file)
@@ -1,25 +1,25 @@
 public interface Camera {
 
-    public void MethodA(int A, Speaker B);
-    public void MethodA(int A, Speaker B, int AB);
+    public void MethodA(int A, int B);
+    public void MethodA(int A, int B, int AB);
     public int MethodB(int C, String D);
-    public String MethodC(String E, Map<int> F);
+    public String MethodC(String E, Map<String,Integer> F);
     public float MethodD(Set<String> G, float H);
     public boolean MethodE(String I, boolean J);
-       public void MethodF(LightBulb K);
+       public void MethodF(int K);
 
        capability ImageCapture {
                description = "The quick brown fox jumps over the smart dog";
                description = "Another description";
-               method = "MethodA(int A, Speaker B)";
+               method = "MethodA(int A, int B)";
                method = "MethodB(int C, String D)";
-               method = "MethodC(String E, Map<int> F)";
+               method = "MethodC(String E, Map<String,Integer> F)";
        }
 
        capability VideoRecording {
                description = "The quick brown fox jumps over the cool dog";
-               method = "MethodA(int A, Speaker B)";
-               method = "MethodA(int A, Speaker B, int AB)";
+               method = "MethodA(int A, int B)";
+               method = "MethodA(int A, int B, int AB)";
                method = "MethodD(Set<String> G, float H)";
        }
 
index 8cfe1c6..6fa1209 100644 (file)
@@ -19,7 +19,7 @@ compiler:
 
 PHONY += run
 run:
-       cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler policy.pol requires.pol -java JavaStub -cplus CPlusStub
+       cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler policy.pol requires.pol -java Java -cplus Cplus
 
 PHONY += doc
 doc: iotruntime iotinstaller
index 7573277..1107451 100644 (file)
@@ -3,6 +3,8 @@ package iotpolicy;
 import java_cup.runtime.ComplexSymbolFactory;
 import java_cup.runtime.ScannerBuffer;
 import java.io.*;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -18,8 +20,8 @@ import iotpolicy.tree.CapabilityDecl;
 import iotpolicy.tree.InterfaceDecl;
 import iotpolicy.tree.RequiresDecl;
 
-/** Class IoTCompiler is the main stub compiler for
- *  stub files generation. This class calls helper classes
+/** Class IoTCompiler is the main interface/stub compiler for
+ *  files generation. This class calls helper classes
  *  such as Parser, Lexer, InterfaceDecl, CapabilityDecl,
  *  RequiresDecl, ParseTreeHandler, etc.
  *
@@ -38,13 +40,117 @@ public class IoTCompiler {
        private CapabilityDecl capDecl;
        private RequiresDecl reqDecl;
        private Map<String,Set<String>> mapCapabMethods;
+       // Data structure to store our types (primitives and non-primitives) for compilation
+       //private Set<String> setPrimitives;
+       private Map<String,String> mapPrimitives;
+       private Map<String,String> mapNonPrimitivesJava;
+       private Map<String,String> mapNonPrimitivesCplus;
        private PrintWriter pw;
        private String dir;
+       private String subdir;
 
        /**
         * Class constants
         */
-       private final static String OUTPUT_DIRECTORY = "stubfiles";
+       private final static String OUTPUT_DIRECTORY = "output_files";
+
+       /**
+        * Primitive data types
+        */
+       private final static String[] primitives = new String[] {
+
+               "byte",
+               "Byte",
+               "short",
+               "Short",
+               "int",
+               "Integer",
+               "long",
+               "Long",
+               "float",
+               "Float",
+               "double",
+               "Double",
+               "boolean",
+               "Boolean",
+               "char",
+               "Character",
+               "string",
+               "String",
+               "void"
+       };
+
+       /**
+        * Primitive data types in C++ to map the primitives list
+        */
+       private final static String[] primitivesCplus = new String[] {
+
+               "char",
+               "char",
+               "short",
+               "short",
+               "int",
+               "int",
+               "long",
+               "long",
+               "float",
+               "float",
+               "double",
+               "double",
+               "bool",
+               "bool",
+               "char",
+               "char",
+               "string",
+               "string",
+               "void"
+       };
+
+       /**
+        * Non-primitive data types supported by this compiler
+        */
+       private final static String[] nonPrimitives = new String[] {
+
+               "Set",
+               "HashSet",
+               "Map",
+               "HashMap",
+               "List",
+               "ArrayList"
+       };
+
+       /**
+        * Non-primitive Java libraries based on the list above
+        */
+       private final static String[] nonPrimitiveJavaLibs = new String[] {
+
+               "java.util.Set",
+               "java.util.HashSet",
+               "java.util.Map",
+               "java.util.HashMap",
+               "java.util.List",
+               "java.util.ArrayList"
+       };
+
+       /**
+        * Non-primitive C++ libraries based on the list above
+        */
+       private final static String[] nonPrimitiveCplusLibs = new String[] {
+
+               "set",
+               "unordered_set",
+               "map",
+               "unordered_map",
+               "list",
+               "list"
+       };
+
+       private enum ParamCategory {
+
+               PRIMITIVES,             // All the primitive types, e.g. byte, short, int, long, etc.
+               NONPRIMITIVES,  // Non-primitive types, e.g. Set, Map, List, etc.
+               USERDEFINED             // Non-supported type by default; assumed as driver classes
+       }
 
        /**
         * Class constructors
@@ -57,8 +163,15 @@ public class IoTCompiler {
                capDecl = null;
                capDecl = null;
                mapCapabMethods = new HashMap<String,Set<String>>();
+               mapPrimitives = new HashMap<String,String>();
+                       arraysToMap(mapPrimitives, primitives, primitivesCplus);
+               mapNonPrimitivesJava = new HashMap<String,String>();
+                       arraysToMap(mapNonPrimitivesJava, nonPrimitives, nonPrimitiveJavaLibs);
+               mapNonPrimitivesCplus = new HashMap<String,String>();
+                       arraysToMap(mapNonPrimitivesCplus, nonPrimitives, nonPrimitiveCplusLibs);
                pw = null;
                dir = OUTPUT_DIRECTORY;
+               subdir = null;
        }
 
 
@@ -70,8 +183,15 @@ public class IoTCompiler {
                capDecl = null;
                reqDecl = null;
                mapCapabMethods = new HashMap<String,Set<String>>();
+               mapPrimitives = new HashMap<String,String>();
+                       arraysToMap(mapPrimitives, primitives, primitivesCplus);
+               mapNonPrimitivesJava = new HashMap<String,String>();
+                       arraysToMap(mapNonPrimitivesJava, nonPrimitives, nonPrimitiveJavaLibs);
+               mapNonPrimitivesCplus = new HashMap<String,String>();
+                       arraysToMap(mapNonPrimitivesCplus, nonPrimitives, nonPrimitiveCplusLibs);
                pw = null;
                dir = OUTPUT_DIRECTORY;
+               subdir = null;
        }
 
 
@@ -135,24 +255,129 @@ public class IoTCompiler {
        }
 
 
+       /**
+        * generateJavaLocalInterface() writes the local interface to provide type-checking
+        * <p>
+        * It needs to rewrite and exchange USERDEFINED types in input parameters of stub
+        * and original interfaces, e.g. exchange Camera and CameraWithVideoAndRecording.
+        * The local interface has to be the input parameter for the stub and the stub 
+        * interface has to be the input parameter for the local class.
+        */
+       public void generateJavaLocalInterface() throws IOException {
+
+               // Create a new directory
+               createDirectory(dir);
+               // Open a new file to write into
+               String intface = origInt;
+               FileWriter fw = new FileWriter(dir + "/" + intface + ".java");
+               pw = new PrintWriter(new BufferedWriter(fw));
+               // Pass in set of methods and get import classes
+               List<String> methods = intDecl.getMethods();
+               Set<String> importClasses = getImportClasses(methods);
+               printImportStatements(importClasses);
+               // Write interface header
+               println("");
+               println("public interface " + intface + " {");
+               // Write methods
+               for (String method : methods) {
+
+                       List<String> methParams = intDecl.getMethodParams(method);
+                       List<String> methPrmTypes = intDecl.getMethodParamTypes(method);
+                       print("public " + intDecl.getMethodType(method) + " " +
+                               intDecl.getMethodId(method) + "(");
+                       for (int i = 0; i < methParams.size(); i++) {
+                               // Check for params with driver class types and exchange it 
+                               //              with its remote interface
+                               String paramType = checkAndGetParamClass(methPrmTypes.get(i));
+                               print(paramType + " " + methParams.get(i));
+                               // Check if this is the last element (don't print a comma)
+                               if (i != methParams.size() - 1) {
+                                       print(", ");
+                               }
+                       }
+                       println(");");
+               }
+               println("}");
+               pw.close();
+               System.out.println("IoTCompiler: Generated local interface " + intface + ".java...");
+       }
+
+
+       /**
+        * generateCplusLocalInterface() writes the local interface to provide type-checking
+        * <p>
+        * It needs to rewrite and exchange USERDEFINED types in input parameters of stub
+        * and original interfaces, e.g. exchange Camera and CameraWithVideoAndRecording.
+        * The local interface has to be the input parameter for the stub and the stub 
+        * interface has to be the input parameter for the local class.
+        */
+       public void generateCplusLocalInterface() throws IOException {
+
+               // Create a new directory
+               createDirectory(dir);
+               // Open a new file to write into
+               String intface = origInt;
+               FileWriter fw = new FileWriter(dir + "/" + intface + ".hpp");
+               pw = new PrintWriter(new BufferedWriter(fw));
+               // Write file headers
+               println("#include <iostream>");
+               // Pass in set of methods and get import classes
+               List<String> methods = intDecl.getMethods();
+               Set<String> includeClasses = getIncludeClasses(methods);
+               printIncludeStatements(includeClasses);
+               println("");
+               println("using namespace std;");
+               println("");
+               println("class " + intface);
+               println("{");
+               println("public:");
+               // Write methods
+               for (String method : methods) {
+
+                       List<String> methParams = intDecl.getMethodParams(method);
+                       List<String> methPrmTypes = intDecl.getMethodParamTypes(method);
+                       print("virtual " + convertType(intDecl.getMethodType(method)) + " " +
+                               intDecl.getMethodId(method) + "(");
+                       for (int i = 0; i < methParams.size(); i++) {
+                               // Check for params with driver class types and exchange it 
+                               //              with its remote interface
+                               String paramType = checkAndGetParamClass(methPrmTypes.get(i));
+                               paramType = checkAndGetCplusType(paramType);
+                               print(paramType + " " + methParams.get(i));
+                               // Check if this is the last element (don't print a comma)
+                               if (i != methParams.size() - 1) {
+                                       print(", ");
+                               }
+                       }
+                       println(") = 0;");
+               }
+               print("}");
+               println(";");
+               pw.close();
+               System.out.println("IoTCompiler: Generated local interface " + intface + ".hpp...");
+       }
+
+
        /**
         * generateJavaInterfaces() generate stub interfaces based on the methods list in Java
         */
        public void generateJavaInterfaces() throws IOException {
 
                // Create a new directory
-               createDirectory(dir);
+               createDirectories(dir, subdir);
                for (Map.Entry<String,Set<String>> intMeth : mapCapabMethods.entrySet()) {
 
                        // Open a new file to write into
                        String newIntface = intMeth.getKey();
-                       FileWriter fw = new FileWriter(dir + "/" + newIntface + ".java");
+                       FileWriter fw = new FileWriter(dir + "/" + subdir + "/" + newIntface + ".java");
                        pw = new PrintWriter(new BufferedWriter(fw));
+                       // Pass in set of methods and get import classes
+                       Set<String> importClasses = getImportClasses(intMeth.getValue());
+                       printImportStatements(importClasses);
                        // Write interface header
                        println("");
                        println("public interface " + newIntface + " {");
                        List<String> meths = intDecl.getMethods();
-
                        // Write methods
                        for (String method : intMeth.getValue()) {
 
@@ -161,7 +386,7 @@ public class IoTCompiler {
                                print("public " + intDecl.getMethodType(method) + " " +
                                        intDecl.getMethodId(method) + "(");
                                for (int i = 0; i < methParams.size(); i++) {
-                                        print(methPrmTypes.get(i) + " " + methParams.get(i));
+                                       print(methPrmTypes.get(i) + " " + methParams.get(i));
                                        // Check if this is the last element (don't print a comma)
                                        if (i != methParams.size() - 1) {
                                                print(", ");
@@ -184,15 +409,18 @@ public class IoTCompiler {
        public void generateCPlusInterfaces() throws IOException {
 
                // Create a new directory
-               createDirectory(dir);
+               createDirectories(dir, subdir);
                for (Map.Entry<String,Set<String>> intMeth : mapCapabMethods.entrySet()) {
 
                        // Open a new file to write into
                        String newIntface = intMeth.getKey();
-                       FileWriter fw = new FileWriter(dir + "/" + newIntface + ".hpp");
+                       FileWriter fw = new FileWriter(dir + "/" + subdir + "/" + newIntface + ".hpp");
                        pw = new PrintWriter(new BufferedWriter(fw));
                        // Write file headers
-                       println("#include<iostream>");
+                       println("#include <iostream>");
+                       // Pass in set of methods and get import classes
+                       Set<String> includeClasses = getIncludeClasses(intMeth.getValue());
+                       printIncludeStatements(includeClasses);
                        println("");
                        println("using namespace std;");
                        println("");
@@ -207,7 +435,9 @@ public class IoTCompiler {
                                print("virtual " + convertType(intDecl.getMethodType(method)) + " " +
                                        intDecl.getMethodId(method) + "(");
                                for (int i = 0; i < methParams.size(); i++) {
-                                        print(convertType(methPrmTypes.get(i)) + " " + methParams.get(i));
+
+                                       String methPrmType = checkAndGetCplusType(methPrmTypes.get(i));
+                                       print(methPrmType + " " + methParams.get(i));
                                        // Check if this is the last element (don't print a comma)
                                        if (i != methParams.size() - 1) {
                                                print(", ");
@@ -229,14 +459,17 @@ public class IoTCompiler {
        public void generateJavaStubClasses() throws IOException {
 
                // Create a new directory
-               createDirectory(dir);
+               createDirectories(dir, subdir);
                for (Map.Entry<String,Set<String>> intMeth : mapCapabMethods.entrySet()) {
 
                        // Open a new file to write into
                        String newIntface = intMeth.getKey();
                        String newStubClass = newIntface + "_Stub";
-                       FileWriter fw = new FileWriter(dir + "/" + newStubClass + ".java");
+                       FileWriter fw = new FileWriter(dir + "/" + subdir + "/" + newStubClass + ".java");
                        pw = new PrintWriter(new BufferedWriter(fw));
+                       // Pass in set of methods and get import classes
+                       Set<String> importClasses = getImportClasses(intMeth.getValue());
+                       printImportStatements(importClasses);
                        // Write interface header
                        println("");
                        println("public class " + newStubClass + " implements " + newIntface + " {");
@@ -249,7 +482,8 @@ public class IoTCompiler {
                                print("public " + intDecl.getMethodType(method) + " " +
                                        intDecl.getMethodId(method) + "(");
                                for (int i = 0; i < methParams.size(); i++) {
-                                        print(methPrmTypes.get(i) + " " + methParams.get(i));
+
+                                       print(methPrmTypes.get(i) + " " + methParams.get(i));
                                        // Check if this is the last element (don't print a comma)
                                        if (i != methParams.size() - 1) {
                                                print(", ");
@@ -261,8 +495,7 @@ public class IoTCompiler {
                                        String retStmt = generateReturnStmt(intDecl.getMethodType(method));
                                        println("return " + retStmt + ";");
                                }
-                               println("}");
-                               println("");
+                               println("}"); println("");
                        }
                        println("}");
                        pw.close();
@@ -277,16 +510,16 @@ public class IoTCompiler {
        public void generateCPlusStubClasses() throws IOException {
 
                // Create a new directory
-               createDirectory(dir);
+               createDirectories(dir, subdir);
                for (Map.Entry<String,Set<String>> intMeth : mapCapabMethods.entrySet()) {
 
                        // Open a new file to write into
                        String newIntface = intMeth.getKey();
                        String newStubClass = newIntface + "_Stub";
-                       FileWriter fw = new FileWriter(dir + "/" + newStubClass + ".hpp");
+                       FileWriter fw = new FileWriter(dir + "/" + subdir + "/" + newStubClass + ".hpp");
                        pw = new PrintWriter(new BufferedWriter(fw));
                        // Write file headers
-                       println("#include<iostream>");
+                       println("#include <iostream>");
                        println("#include \"" + newIntface + ".hpp\""); println("");            
                        println("using namespace std;"); println("");
                        println("class " + newStubClass + " : public " + newIntface);
@@ -303,7 +536,9 @@ public class IoTCompiler {
                                print(convertType(intDecl.getMethodType(method)) + " " +
                                        intDecl.getMethodId(method) + "(");
                                for (int i = 0; i < methParams.size(); i++) {
-                                        print(convertType(methPrmTypes.get(i)) + " " + methParams.get(i));
+
+                                       String methPrmType = checkAndGetCplusType(methPrmTypes.get(i));
+                                       print(methPrmType + " " + methParams.get(i));
                                        // Check if this is the last element (don't print a comma)
                                        if (i != methParams.size() - 1) {
                                                print(", ");
@@ -359,9 +594,9 @@ public class IoTCompiler {
        /**
         * setDirectory() set a new directory for stub files
         */
-       public void setDirectory(String _dir) {
+       public void setDirectory(String _subdir) {
 
-               dir = _dir;
+               subdir = _subdir;
        }
 
 
@@ -410,27 +645,7 @@ public class IoTCompiler {
         */
        private String convertType(String jType) {
 
-               // Generate dummy returns for now
-               if (jType.equals("short")||
-                       jType.equals("int")  ||
-                       jType.equals("long") ||
-                       jType.equals("char") ||
-                       jType.equals("float")||
-                       jType.equals("double")) {
-
-                       return jType;
-               } else if ( jType.equals("String")) {
-  
-                       return "string";
-               } else if ( jType.equals("byte")) {
-
-                       return "char";
-               } else if ( jType.equals("boolean")) {
-
-                       return "bool";
-               } else {
-                       return jType;
-               }       
+               return mapPrimitives.get(jType);
        }
 
 
@@ -479,6 +694,173 @@ public class IoTCompiler {
        }
 
 
+       // Create a directory and possibly a sub directory
+       private void createDirectories(String dir, String subdir) {
+
+               createDirectory(dir);
+               if (subdir != null) {
+                       createDirectory(dir + "/" + subdir);
+               }
+       }
+
+
+       // Inserting array members into a Map object
+       // that maps arrKey to arrVal objects
+       private void arraysToMap(Map map, Object[] arrKey, Object[] arrVal) {
+
+               for(int i = 0; i < arrKey.length; i++) {
+
+                       map.put(arrKey[i], arrVal[i]);
+               }
+       }
+
+
+       // Return parameter category, i.e. PRIMITIVES, NONPRIMITIVES, or USERDEFINED
+       private ParamCategory getParamCategory(String paramType) {
+
+               if (mapPrimitives.containsKey(paramType)) {
+                       return ParamCategory.PRIMITIVES;
+               // We can either use mapNonPrimitivesJava or mapNonPrimitivesCplus here
+               } else if (mapNonPrimitivesJava.containsKey(getSimpleType(paramType))) {
+                       return ParamCategory.NONPRIMITIVES;
+               } else
+                       return ParamCategory.USERDEFINED;
+       }
+
+
+       // Return full class name for non-primitives to generate Java import statements
+       // e.g. java.util.Set for Set, java.util.Map for Map
+       private String getNonPrimitiveJavaClass(String paramNonPrimitives) {
+
+               return mapNonPrimitivesJava.get(paramNonPrimitives);
+       }
+
+
+       // Return full class name for non-primitives to generate Cplus include statements
+       // e.g. #include <set> for Set, #include <map> for Map
+       private String getNonPrimitiveCplusClass(String paramNonPrimitives) {
+
+               return mapNonPrimitivesCplus.get(paramNonPrimitives);
+       }
+
+
+       // Get simple types, e.g. HashSet for HashSet<...>
+       // Basically strip off the "<...>"
+       private String getSimpleType(String paramType) {
+
+               // Check if this is generics
+               if(paramType.contains("<")) {
+                       String[] type = paramType.split("<");
+                       return type[0];
+               } else
+                       return paramType;
+       }
+
+
+       // Generate a set of classes for import statements
+       private Set<String> getImportClasses(Collection<String> methods) {
+
+               Set<String> importClasses = new HashSet<String>();
+               for (String method : methods) {
+                       List<String> methPrmTypes = intDecl.getMethodParamTypes(method);
+                       for (String paramType : methPrmTypes) {
+
+                               String simpleType = getSimpleType(paramType);
+                               if (getParamCategory(simpleType) == ParamCategory.NONPRIMITIVES) {
+                                       importClasses.add(getNonPrimitiveJavaClass(simpleType));
+                               }
+                       }
+               }
+               return importClasses;
+       }
+
+
+       // Generate a set of classes for include statements
+       private Set<String> getIncludeClasses(Collection<String> methods) {
+
+               Set<String> includeClasses = new HashSet<String>();
+               for (String method : methods) {
+
+                       List<String> methPrmTypes = intDecl.getMethodParamTypes(method);
+                       for (String paramType : methPrmTypes) {
+
+                               String simpleType = getSimpleType(paramType);
+                               if (getParamCategory(simpleType) == ParamCategory.NONPRIMITIVES) {
+                                       includeClasses.add(getNonPrimitiveCplusClass(simpleType));
+                               }
+                       }
+               }
+               return includeClasses;
+       }
+
+
+       private void printImportStatements(Set<String> importClasses) {
+
+               for(String cls : importClasses) {
+                       println("import " + cls + ";");
+               }
+       }
+
+
+       private void printIncludeStatements(Set<String> includeClasses) {
+
+               for(String cls : includeClasses) {
+                       println("#include <" + cls + ">");
+               }
+       }
+
+
+       // Get the C++ version of a non-primitive type
+       // e.g. set for Set and map for Map
+       // Input nonPrimitiveType has to be generics in format
+       private String[] getTypeOfGeneric(String nonPrimitiveType) {
+
+               // Handle <, >, and , for 2-type generic/template
+               String[] substr = nonPrimitiveType.split("<")[1].split(">")[0].split(",");
+               return substr;
+       }
+
+
+       private String checkAndGetCplusType(String paramType) {
+
+               if (getParamCategory(paramType) == ParamCategory.PRIMITIVES) {
+                       return convertType(paramType);
+               } else if (getParamCategory(paramType) == ParamCategory.NONPRIMITIVES) {
+
+                       // Check for generic/template format
+                       if (paramType.contains("<") && paramType.contains(">")) {
+
+                               String genericClass = getSimpleType(paramType);
+                               String[] genericType = getTypeOfGeneric(paramType);
+                               String cplusTemplate = null;
+                               if (genericType.length == 1) // Generic/template with one type
+                                       cplusTemplate = getNonPrimitiveCplusClass(genericClass) + 
+                                               "<" + convertType(genericType[0]) + ">";
+                               else // Generic/template with two types
+                                       cplusTemplate = getNonPrimitiveCplusClass(genericClass) + 
+                                               "<" + convertType(genericType[0]) + "," + convertType(genericType[1]) + ">";
+                               return cplusTemplate;
+                       } else
+                               return getNonPrimitiveCplusClass(paramType);
+               } else
+                       // Just return it as is if it's not non-primitives
+                       return paramType;
+       }
+
+
+       // Get simple types, e.g. HashSet for HashSet<...>
+       // Basically strip off the "<...>"
+       private String checkAndGetParamClass(String paramType) {
+
+               // Check if this is generics
+               if(getParamCategory(paramType) == ParamCategory.USERDEFINED) {
+                       // TODO: replace this with the proper stub interface name
+                       return paramType + "Remote";
+               } else
+                       return paramType;
+       }
+
+
        public static void main(String[] args) throws Exception {
 
                // Runtime options
@@ -508,8 +890,10 @@ public class IoTCompiler {
                                comp.parsePolicyFile();
                                comp.getMethodsForIntface();
                                if (args.length == 2) {
+                                       comp.generateJavaLocalInterface();
                                        comp.generateJavaInterfaces();
                                        comp.generateJavaStubClasses();
+                                       comp.generateCplusLocalInterface();
                                        comp.generateCPlusInterfaces();
                                        comp.generateCPlusStubClasses();
                                } else {
@@ -522,9 +906,11 @@ public class IoTCompiler {
                                                } else
                                                        throw new Error("IoTCompiler: ERROR - please provide <directory> after option: " + args[i]);
                                                if (args[i].equals("-java")) {
+                                                       comp.generateJavaLocalInterface();
                                                        comp.generateJavaInterfaces();
                                                        comp.generateJavaStubClasses();
                                                } else if (args[i].equals("-cplus")) {
+                                                       comp.generateCplusLocalInterface();
                                                        comp.generateCPlusInterfaces();
                                                        comp.generateCPlusStubClasses();
                                                } else
index 0e9d534..947b4e3 100644 (file)
@@ -45,13 +45,13 @@ public class Lexer implements java_cup.runtime.Scanner, sym {
    * Translates characters to character classes
    */
   private static final String ZZ_CMAP_PACKED = 
-    "\11\0\1\6\1\4\1\46\1\6\1\3\22\0\1\6\1\0\1\36"+
+    "\11\0\1\6\1\4\1\50\1\6\1\3\22\0\1\6\1\0\1\36"+
     "\1\0\1\1\3\0\1\40\1\41\2\0\1\37\3\0\12\2\1\0"+
-    "\1\5\1\2\1\44\1\2\2\0\22\1\1\30\7\1\1\0\1\45"+
+    "\1\5\1\42\1\46\1\43\2\0\22\1\1\30\7\1\1\0\1\47"+
     "\2\0\1\1\1\0\1\24\1\16\1\27\1\25\1\20\1\23\1\22"+
     "\1\13\1\7\2\1\1\21\1\33\1\10\1\14\1\32\1\34\1\15"+
-    "\1\12\1\11\1\26\1\31\1\35\1\1\1\17\1\1\1\42\1\0"+
-    "\1\43\7\0\1\46\u1fa2\0\1\46\1\46\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\udfe6\0";
+    "\1\12\1\11\1\26\1\31\1\35\1\1\1\17\1\1\1\44\1\0"+
+    "\1\45\7\0\1\50\u1fa2\0\1\50\1\50\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\udfe6\0";
 
   /** 
    * Translates characters to character classes
@@ -66,14 +66,15 @@ public class Lexer implements java_cup.runtime.Scanner, sym {
   private static final String ZZ_ACTION_PACKED_0 =
     "\2\0\1\1\1\2\2\3\1\4\16\2\1\5\1\6"+
     "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16"+
-    "\1\0\10\2\1\17\11\2\1\20\1\21\1\22\1\23"+
-    "\1\24\25\2\1\25\1\26\3\2\1\27\2\2\1\30"+
-    "\2\2\1\31\2\2\1\32\2\2\1\33\7\2\1\34"+
-    "\2\2\1\35\2\2\1\36\1\37\1\40\2\2\1\41"+
-    "\3\2\1\42\2\2\1\43\3\2\1\44\1\45";
+    "\1\17\1\20\1\0\10\2\1\21\11\2\1\22\1\23"+
+    "\1\24\1\25\1\26\25\2\1\27\1\30\3\2\1\31"+
+    "\2\2\1\32\2\2\1\33\2\2\1\34\2\2\1\35"+
+    "\7\2\1\36\2\2\1\37\2\2\1\40\1\41\1\42"+
+    "\2\2\1\43\3\2\1\44\2\2\1\45\3\2\1\46"+
+    "\1\47";
 
   private static int [] zzUnpackAction() {
-    int [] result = new int[125];
+    int [] result = new int[127];
     int offset = 0;
     offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
     return result;
@@ -98,25 +99,25 @@ public class Lexer implements java_cup.runtime.Scanner, sym {
   private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
 
   private static final String ZZ_ROWMAP_PACKED_0 =
-    "\0\0\0\47\0\116\0\165\0\234\0\116\0\116\0\303"+
-    "\0\352\0\u0111\0\u0138\0\u015f\0\u0186\0\u01ad\0\u01d4\0\u01fb"+
-    "\0\u0222\0\u0249\0\u0270\0\u0297\0\u02be\0\116\0\116\0\116"+
-    "\0\116\0\116\0\116\0\116\0\u02e5\0\116\0\u030c\0\u0333"+
-    "\0\u035a\0\u0381\0\u03a8\0\u03cf\0\u03f6\0\u041d\0\u0444\0\u046b"+
-    "\0\165\0\u0492\0\u04b9\0\u04e0\0\u0507\0\u052e\0\u0555\0\u057c"+
-    "\0\u05a3\0\u05ca\0\116\0\116\0\116\0\116\0\u05f1\0\u0618"+
-    "\0\u063f\0\u0666\0\u068d\0\u06b4\0\u06db\0\u0702\0\u0729\0\u0750"+
-    "\0\u0777\0\u079e\0\u07c5\0\u07ec\0\u0813\0\u083a\0\u0861\0\u0888"+
-    "\0\u08af\0\u08d6\0\u08fd\0\u0924\0\165\0\165\0\u094b\0\u0972"+
-    "\0\u0999\0\165\0\u09c0\0\u09e7\0\165\0\u0a0e\0\u0a35\0\165"+
-    "\0\u0a5c\0\u0a83\0\165\0\u0aaa\0\u0ad1\0\165\0\u0af8\0\u0b1f"+
-    "\0\u0b46\0\u0b6d\0\u0b94\0\u0bbb\0\u0be2\0\165\0\u0c09\0\u0c30"+
-    "\0\165\0\u0c57\0\u0c7e\0\165\0\165\0\165\0\u0ca5\0\u0ccc"+
-    "\0\165\0\u0cf3\0\u0d1a\0\u0d41\0\165\0\u0d68\0\u0d8f\0\165"+
-    "\0\u0db6\0\u0ddd\0\u0e04\0\165\0\165";
+    "\0\0\0\51\0\122\0\173\0\244\0\122\0\122\0\315"+
+    "\0\366\0\u011f\0\u0148\0\u0171\0\u019a\0\u01c3\0\u01ec\0\u0215"+
+    "\0\u023e\0\u0267\0\u0290\0\u02b9\0\u02e2\0\122\0\122\0\122"+
+    "\0\122\0\122\0\122\0\122\0\122\0\122\0\u030b\0\122"+
+    "\0\u0334\0\u035d\0\u0386\0\u03af\0\u03d8\0\u0401\0\u042a\0\u0453"+
+    "\0\u047c\0\u04a5\0\173\0\u04ce\0\u04f7\0\u0520\0\u0549\0\u0572"+
+    "\0\u059b\0\u05c4\0\u05ed\0\u0616\0\122\0\122\0\122\0\122"+
+    "\0\u063f\0\u0668\0\u0691\0\u06ba\0\u06e3\0\u070c\0\u0735\0\u075e"+
+    "\0\u0787\0\u07b0\0\u07d9\0\u0802\0\u082b\0\u0854\0\u087d\0\u08a6"+
+    "\0\u08cf\0\u08f8\0\u0921\0\u094a\0\u0973\0\u099c\0\173\0\173"+
+    "\0\u09c5\0\u09ee\0\u0a17\0\173\0\u0a40\0\u0a69\0\173\0\u0a92"+
+    "\0\u0abb\0\173\0\u0ae4\0\u0b0d\0\173\0\u0b36\0\u0b5f\0\173"+
+    "\0\u0b88\0\u0bb1\0\u0bda\0\u0c03\0\u0c2c\0\u0c55\0\u0c7e\0\173"+
+    "\0\u0ca7\0\u0cd0\0\173\0\u0cf9\0\u0d22\0\173\0\173\0\173"+
+    "\0\u0d4b\0\u0d74\0\173\0\u0d9d\0\u0dc6\0\u0def\0\173\0\u0e18"+
+    "\0\u0e41\0\173\0\u0e6a\0\u0e93\0\u0ebc\0\173\0\173";
 
   private static int [] zzUnpackRowMap() {
-    int [] result = new int[125];
+    int [] result = new int[127];
     int offset = 0;
     offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
     return result;
@@ -143,77 +144,78 @@ public class Lexer implements java_cup.runtime.Scanner, sym {
     "\2\4\1\11\2\4\1\12\1\13\2\4\1\14\1\4"+
     "\1\15\1\16\1\17\1\4\1\20\1\21\1\22\1\23"+
     "\1\24\1\4\1\25\1\26\1\27\1\30\1\31\1\32"+
-    "\1\33\1\34\1\3\1\0\3\35\1\0\1\3\31\35"+
-    "\1\36\6\35\1\37\1\35\50\0\2\4\4\0\27\4"+
-    "\15\0\1\40\43\0\2\4\4\0\1\4\1\41\25\4"+
-    "\12\0\2\4\4\0\2\4\1\42\1\4\1\43\22\4"+
-    "\12\0\2\4\4\0\11\4\1\44\15\4\12\0\2\4"+
-    "\4\0\5\4\1\45\2\4\1\46\16\4\12\0\2\4"+
-    "\4\0\5\4\1\47\21\4\12\0\2\4\4\0\12\4"+
-    "\1\50\14\4\12\0\2\4\4\0\3\4\1\51\23\4"+
-    "\12\0\2\4\4\0\5\4\1\52\3\4\1\53\15\4"+
-    "\12\0\2\4\4\0\4\4\1\54\10\4\1\55\11\4"+
-    "\12\0\2\4\4\0\2\4\1\56\24\4\12\0\2\4"+
-    "\4\0\5\4\1\57\21\4\12\0\2\4\4\0\17\4"+
-    "\1\60\7\4\12\0\2\4\4\0\11\4\1\61\15\4"+
-    "\12\0\2\4\4\0\1\62\26\4\11\0\3\35\2\0"+
-    "\31\35\1\0\6\35\1\0\1\35\10\0\1\63\1\64"+
-    "\3\0\1\65\20\0\1\66\15\0\1\6\42\0\2\4"+
-    "\4\0\2\4\1\67\24\4\12\0\2\4\4\0\6\4"+
-    "\1\70\20\4\12\0\2\4\4\0\5\4\1\71\21\4"+
-    "\12\0\2\4\4\0\25\4\1\72\1\4\12\0\2\4"+
-    "\4\0\5\4\1\73\21\4\12\0\2\4\4\0\2\4"+
-    "\1\74\24\4\12\0\2\4\4\0\1\4\1\75\25\4"+
-    "\12\0\2\4\4\0\5\4\1\76\21\4\12\0\2\4"+
-    "\4\0\17\4\1\77\7\4\12\0\2\4\4\0\3\4"+
-    "\1\100\23\4\12\0\2\4\4\0\15\4\1\101\11\4"+
-    "\12\0\2\4\4\0\23\4\1\102\3\4\12\0\2\4"+
-    "\4\0\6\4\1\103\20\4\12\0\2\4\4\0\1\104"+
-    "\26\4\12\0\2\4\4\0\7\4\1\105\17\4\12\0"+
-    "\2\4\4\0\2\4\1\106\24\4\12\0\2\4\4\0"+
-    "\2\4\1\107\24\4\12\0\2\4\4\0\11\4\1\110"+
-    "\15\4\12\0\2\4\4\0\1\111\26\4\12\0\2\4"+
-    "\4\0\6\4\1\112\20\4\12\0\2\4\4\0\17\4"+
-    "\1\113\7\4\12\0\2\4\4\0\12\4\1\114\14\4"+
-    "\12\0\2\4\4\0\11\4\1\115\15\4\12\0\2\4"+
-    "\4\0\13\4\1\116\13\4\12\0\2\4\4\0\15\4"+
-    "\1\117\11\4\12\0\2\4\4\0\7\4\1\120\17\4"+
-    "\12\0\2\4\4\0\20\4\1\121\6\4\12\0\2\4"+
-    "\4\0\6\4\1\122\20\4\12\0\2\4\4\0\15\4"+
-    "\1\123\11\4\12\0\2\4\4\0\1\124\26\4\12\0"+
-    "\2\4\4\0\16\4\1\125\10\4\12\0\2\4\4\0"+
-    "\12\4\1\126\14\4\12\0\2\4\4\0\4\4\1\127"+
-    "\22\4\12\0\2\4\4\0\4\4\1\130\22\4\12\0"+
-    "\2\4\4\0\6\4\1\131\20\4\12\0\2\4\4\0"+
-    "\1\4\1\132\25\4\12\0\2\4\4\0\2\4\1\133"+
-    "\24\4\12\0\2\4\4\0\1\134\26\4\12\0\2\4"+
-    "\4\0\11\4\1\135\15\4\12\0\2\4\4\0\2\4"+
-    "\1\136\24\4\12\0\2\4\4\0\12\4\1\137\14\4"+
-    "\12\0\2\4\4\0\6\4\1\140\20\4\12\0\2\4"+
-    "\4\0\7\4\1\141\17\4\12\0\2\4\4\0\1\4"+
-    "\1\142\25\4\12\0\2\4\4\0\1\143\26\4\12\0"+
-    "\2\4\4\0\5\4\1\144\21\4\12\0\2\4\4\0"+
-    "\14\4\1\145\12\4\12\0\2\4\4\0\13\4\1\146"+
-    "\13\4\12\0\2\4\4\0\6\4\1\147\20\4\12\0"+
-    "\2\4\4\0\15\4\1\150\11\4\12\0\2\4\4\0"+
-    "\11\4\1\151\15\4\12\0\2\4\4\0\1\152\26\4"+
-    "\12\0\2\4\4\0\1\153\26\4\12\0\2\4\4\0"+
-    "\13\4\1\154\13\4\12\0\2\4\4\0\20\4\1\155"+
-    "\6\4\12\0\2\4\4\0\16\4\1\156\10\4\12\0"+
-    "\2\4\4\0\15\4\1\157\11\4\12\0\2\4\4\0"+
-    "\11\4\1\160\15\4\12\0\2\4\4\0\1\4\1\161"+
-    "\25\4\12\0\2\4\4\0\23\4\1\162\3\4\12\0"+
-    "\2\4\4\0\12\4\1\163\14\4\12\0\2\4\4\0"+
-    "\20\4\1\164\6\4\12\0\2\4\4\0\3\4\1\165"+
-    "\23\4\12\0\2\4\4\0\2\4\1\166\24\4\12\0"+
-    "\2\4\4\0\1\167\26\4\12\0\2\4\4\0\11\4"+
-    "\1\170\15\4\12\0\2\4\4\0\1\171\26\4\12\0"+
-    "\2\4\4\0\2\4\1\172\24\4\12\0\2\4\4\0"+
-    "\5\4\1\173\21\4\12\0\2\4\4\0\10\4\1\174"+
-    "\16\4\12\0\2\4\4\0\1\4\1\175\25\4\11\0";
+    "\1\33\1\34\1\35\1\36\1\3\1\0\3\37\1\0"+
+    "\1\3\31\37\1\40\10\37\1\41\1\37\52\0\2\4"+
+    "\4\0\27\4\17\0\1\42\45\0\2\4\4\0\1\4"+
+    "\1\43\25\4\14\0\2\4\4\0\2\4\1\44\1\4"+
+    "\1\45\22\4\14\0\2\4\4\0\11\4\1\46\15\4"+
+    "\14\0\2\4\4\0\5\4\1\47\2\4\1\50\16\4"+
+    "\14\0\2\4\4\0\5\4\1\51\21\4\14\0\2\4"+
+    "\4\0\12\4\1\52\14\4\14\0\2\4\4\0\3\4"+
+    "\1\53\23\4\14\0\2\4\4\0\5\4\1\54\3\4"+
+    "\1\55\15\4\14\0\2\4\4\0\4\4\1\56\10\4"+
+    "\1\57\11\4\14\0\2\4\4\0\2\4\1\60\24\4"+
+    "\14\0\2\4\4\0\5\4\1\61\21\4\14\0\2\4"+
+    "\4\0\17\4\1\62\7\4\14\0\2\4\4\0\11\4"+
+    "\1\63\15\4\14\0\2\4\4\0\1\64\26\4\13\0"+
+    "\3\37\2\0\31\37\1\0\10\37\1\0\1\37\10\0"+
+    "\1\65\1\66\3\0\1\67\20\0\1\70\17\0\1\6"+
+    "\44\0\2\4\4\0\2\4\1\71\24\4\14\0\2\4"+
+    "\4\0\6\4\1\72\20\4\14\0\2\4\4\0\5\4"+
+    "\1\73\21\4\14\0\2\4\4\0\25\4\1\74\1\4"+
+    "\14\0\2\4\4\0\5\4\1\75\21\4\14\0\2\4"+
+    "\4\0\2\4\1\76\24\4\14\0\2\4\4\0\1\4"+
+    "\1\77\25\4\14\0\2\4\4\0\5\4\1\100\21\4"+
+    "\14\0\2\4\4\0\17\4\1\101\7\4\14\0\2\4"+
+    "\4\0\3\4\1\102\23\4\14\0\2\4\4\0\15\4"+
+    "\1\103\11\4\14\0\2\4\4\0\23\4\1\104\3\4"+
+    "\14\0\2\4\4\0\6\4\1\105\20\4\14\0\2\4"+
+    "\4\0\1\106\26\4\14\0\2\4\4\0\7\4\1\107"+
+    "\17\4\14\0\2\4\4\0\2\4\1\110\24\4\14\0"+
+    "\2\4\4\0\2\4\1\111\24\4\14\0\2\4\4\0"+
+    "\11\4\1\112\15\4\14\0\2\4\4\0\1\113\26\4"+
+    "\14\0\2\4\4\0\6\4\1\114\20\4\14\0\2\4"+
+    "\4\0\17\4\1\115\7\4\14\0\2\4\4\0\12\4"+
+    "\1\116\14\4\14\0\2\4\4\0\11\4\1\117\15\4"+
+    "\14\0\2\4\4\0\13\4\1\120\13\4\14\0\2\4"+
+    "\4\0\15\4\1\121\11\4\14\0\2\4\4\0\7\4"+
+    "\1\122\17\4\14\0\2\4\4\0\20\4\1\123\6\4"+
+    "\14\0\2\4\4\0\6\4\1\124\20\4\14\0\2\4"+
+    "\4\0\15\4\1\125\11\4\14\0\2\4\4\0\1\126"+
+    "\26\4\14\0\2\4\4\0\16\4\1\127\10\4\14\0"+
+    "\2\4\4\0\12\4\1\130\14\4\14\0\2\4\4\0"+
+    "\4\4\1\131\22\4\14\0\2\4\4\0\4\4\1\132"+
+    "\22\4\14\0\2\4\4\0\6\4\1\133\20\4\14\0"+
+    "\2\4\4\0\1\4\1\134\25\4\14\0\2\4\4\0"+
+    "\2\4\1\135\24\4\14\0\2\4\4\0\1\136\26\4"+
+    "\14\0\2\4\4\0\11\4\1\137\15\4\14\0\2\4"+
+    "\4\0\2\4\1\140\24\4\14\0\2\4\4\0\12\4"+
+    "\1\141\14\4\14\0\2\4\4\0\6\4\1\142\20\4"+
+    "\14\0\2\4\4\0\7\4\1\143\17\4\14\0\2\4"+
+    "\4\0\1\4\1\144\25\4\14\0\2\4\4\0\1\145"+
+    "\26\4\14\0\2\4\4\0\5\4\1\146\21\4\14\0"+
+    "\2\4\4\0\14\4\1\147\12\4\14\0\2\4\4\0"+
+    "\13\4\1\150\13\4\14\0\2\4\4\0\6\4\1\151"+
+    "\20\4\14\0\2\4\4\0\15\4\1\152\11\4\14\0"+
+    "\2\4\4\0\11\4\1\153\15\4\14\0\2\4\4\0"+
+    "\1\154\26\4\14\0\2\4\4\0\1\155\26\4\14\0"+
+    "\2\4\4\0\13\4\1\156\13\4\14\0\2\4\4\0"+
+    "\20\4\1\157\6\4\14\0\2\4\4\0\16\4\1\160"+
+    "\10\4\14\0\2\4\4\0\15\4\1\161\11\4\14\0"+
+    "\2\4\4\0\11\4\1\162\15\4\14\0\2\4\4\0"+
+    "\1\4\1\163\25\4\14\0\2\4\4\0\23\4\1\164"+
+    "\3\4\14\0\2\4\4\0\12\4\1\165\14\4\14\0"+
+    "\2\4\4\0\20\4\1\166\6\4\14\0\2\4\4\0"+
+    "\3\4\1\167\23\4\14\0\2\4\4\0\2\4\1\170"+
+    "\24\4\14\0\2\4\4\0\1\171\26\4\14\0\2\4"+
+    "\4\0\11\4\1\172\15\4\14\0\2\4\4\0\1\173"+
+    "\26\4\14\0\2\4\4\0\2\4\1\174\24\4\14\0"+
+    "\2\4\4\0\5\4\1\175\21\4\14\0\2\4\4\0"+
+    "\10\4\1\176\16\4\14\0\2\4\4\0\1\4\1\177"+
+    "\25\4\13\0";
 
   private static int [] zzUnpackTrans() {
-    int [] result = new int[3627];
+    int [] result = new int[3813];
     int offset = 0;
     offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
     return result;
@@ -251,11 +253,11 @@ public class Lexer implements java_cup.runtime.Scanner, sym {
   private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
 
   private static final String ZZ_ATTRIBUTE_PACKED_0 =
-    "\2\0\1\11\2\1\2\11\16\1\7\11\1\1\1\11"+
+    "\2\0\1\11\2\1\2\11\16\1\11\11\1\1\1\11"+
     "\1\1\1\0\22\1\4\11\107\1";
 
   private static int [] zzUnpackAttribute() {
-    int [] result = new int[125];
+    int [] result = new int[127];
     int offset = 0;
     offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
     return result;
@@ -747,152 +749,160 @@ public class Lexer implements java_cup.runtime.Scanner, sym {
             { /* throw new Error("Illegal character <"+ yytext()+">");*/
                    error("Illegal character <"+ yytext()+">");
             }
-          case 38: break;
+          case 40: break;
           case 2: 
             { return symbol("Identifier",IDENT, yytext());
             }
-          case 39: break;
+          case 41: break;
           case 3: 
             { /* ignore */
             }
-          case 40: break;
+          case 42: break;
           case 4: 
             { return symbol("semicolon",SEMICOLON);
             }
-          case 41: break;
+          case 43: break;
           case 5: 
             { string.setLength(0); yybegin(STRING);
             }
-          case 42: break;
+          case 44: break;
           case 6: 
             { return symbol("comma",COMMA);
             }
-          case 43: break;
+          case 45: break;
           case 7: 
             { return symbol("(",LPAR);
             }
-          case 44: break;
+          case 46: break;
           case 8: 
             { return symbol(")",RPAR);
             }
-          case 45: break;
+          case 47: break;
           case 9: 
-            { return symbol("{",BEGIN);
+            { return symbol("<",LANG);
             }
-          case 46: break;
+          case 48: break;
           case 10: 
-            { return symbol("}",END);
+            { return symbol(">",RANG);
             }
-          case 47: break;
+          case 49: break;
           case 11: 
-            { return symbol("=",ASSIGN);
+            { return symbol("{",BEGIN);
             }
-          case 48: break;
+          case 50: break;
           case 12: 
-            { string.append( yytext() );
+            { return symbol("}",END);
             }
-          case 49: break;
+          case 51: break;
           case 13: 
+            { return symbol("=",ASSIGN);
+            }
+          case 52: break;
+          case 14: 
+            { string.append( yytext() );
+            }
+          case 53: break;
+          case 15: 
             { yybegin(YYINITIAL); 
       return symbol("StringConst",STRINGCONST,string.toString(),string.length());
             }
-          case 50: break;
-          case 14
+          case 54: break;
+          case 16
             { string.append('\\');
             }
-          case 51: break;
-          case 15
+          case 55: break;
+          case 17
             { return symbol("as",AS);
             }
-          case 52: break;
-          case 16
+          case 56: break;
+          case 18
             { string.append('\n');
             }
-          case 53: break;
-          case 17
+          case 57: break;
+          case 19
             { string.append('\t');
             }
-          case 54: break;
-          case 18
+          case 58: break;
+          case 20
             { string.append('\r');
             }
-          case 55: break;
-          case 19
+          case 59: break;
+          case 21
             { string.append('\"');
             }
-          case 56: break;
-          case 20
+          case 60: break;
+          case 22
             { return symbol("int",TYPE, "int" );
             }
-          case 57: break;
-          case 21
+          case 61: break;
+          case 23
             { return symbol("byte",TYPE, "byte" );
             }
-          case 58: break;
-          case 22
+          case 62: break;
+          case 24
             { return symbol("long",TYPE, "long" );
             }
-          case 59: break;
-          case 23
+          case 63: break;
+          case 25
             { return symbol("char",TYPE, "char" );
             }
-          case 60: break;
-          case 24
+          case 64: break;
+          case 26
             { return symbol("void",TYPE, "void" );
             }
-          case 61: break;
-          case 25
+          case 65: break;
+          case 27
             { return symbol("with",WITH);
             }
-          case 62: break;
-          case 26
+          case 66: break;
+          case 28
             { return symbol("short",TYPE, "short" );
             }
-          case 63: break;
-          case 27
+          case 67: break;
+          case 29
             { return symbol("float",TYPE, "float" );
             }
-          case 64: break;
-          case 28
+          case 68: break;
+          case 30
             { return symbol("string",TYPE, "String" );
             }
-          case 65: break;
-          case 29
+          case 69: break;
+          case 31
             { return symbol("double",TYPE, "double" );
             }
-          case 66: break;
-          case 30
+          case 70: break;
+          case 32
             { return symbol("String",TYPE, "String" );
             }
-          case 67: break;
-          case 31
+          case 71: break;
+          case 33
             { return symbol("public",PUBLIC);
             }
-          case 68: break;
-          case 32
+          case 72: break;
+          case 34
             { return symbol("method",METHOD);
             }
-          case 69: break;
-          case 33
+          case 73: break;
+          case 35
             { return symbol("boolean",TYPE, "boolean" );
             }
-          case 70: break;
-          case 34
+          case 74: break;
+          case 36
             { return symbol("requires",REQUIRES);
             }
-          case 71: break;
-          case 35
+          case 75: break;
+          case 37
             { return symbol("interface",INTERFACE);
             }
-          case 72: break;
-          case 36
+          case 76: break;
+          case 38
             { return symbol("capability",CAPABILITY);
             }
-          case 73: break;
-          case 37
+          case 77: break;
+          case 39
             { return symbol("description",DESCRIPTION);
             }
-          case 74: break;
+          case 78: break;
           default:
             zzScanError(ZZ_NO_MATCH);
         }
index cc7af92..34802a2 100644 (file)
@@ -39,15 +39,19 @@ public class Parser extends java_cup.runtime.lr_parser {
   /** Production table. */
   protected static final short _production_table[][] = 
     unpackFromStrings(new String[] {
-    "\000\033\000\002\002\003\000\002\002\004\000\002\002" +
+    "\000\047\000\002\002\003\000\002\002\004\000\002\002" +
     "\003\000\002\003\011\000\002\004\004\000\002\004\002" +
     "\000\002\005\011\000\002\005\011\000\002\006\004\000" +
     "\002\006\002\000\002\007\005\000\002\007\004\000\002" +
-    "\007\005\000\002\007\004\000\002\010\004\000\002\010" +
-    "\002\000\002\011\007\000\002\012\004\000\002\012\002" +
-    "\000\002\013\006\000\002\013\006\000\002\014\004\000" +
-    "\002\014\002\000\002\015\012\000\002\016\003\000\002" +
-    "\016\005\000\002\016\002" });
+    "\007\005\000\002\007\004\000\002\007\007\000\002\007" +
+    "\007\000\002\007\011\000\002\007\011\000\002\007\011" +
+    "\000\002\007\011\000\002\007\010\000\002\007\010\000" +
+    "\002\007\012\000\002\007\012\000\002\007\012\000\002" +
+    "\007\012\000\002\010\004\000\002\010\002\000\002\011" +
+    "\007\000\002\012\004\000\002\012\002\000\002\013\006" +
+    "\000\002\013\006\000\002\014\004\000\002\014\002\000" +
+    "\002\015\012\000\002\016\003\000\002\016\005\000\002" +
+    "\016\002" });
 
   /** Access to production table. */
   public short[][] production_table() {return _production_table;}
@@ -55,42 +59,60 @@ public class Parser extends java_cup.runtime.lr_parser {
   /** Parse-action table. */
   protected static final short[][] _action_table = 
     unpackFromStrings(new String[] {
-    "\000\074\000\010\002\uffeb\013\006\020\uffeb\001\002\000" +
-    "\004\002\001\001\002\000\006\002\uffff\020\063\001\002" +
-    "\000\004\014\011\001\002\000\004\002\010\001\002\000" +
-    "\004\002\000\001\002\000\004\024\012\001\002\000\004" +
-    "\010\013\001\002\000\010\011\ufffc\013\ufffc\015\ufffc\001" +
-    "\002\000\010\011\ufff2\013\016\015\ufff2\001\002\000\010" +
-    "\011\ufffd\013\ufffd\015\ufffd\001\002\000\006\023\041\024" +
-    "\040\001\002\000\006\011\022\015\021\001\002\000\006" +
-    "\011\ufff3\015\ufff3\001\002\000\004\024\023\001\002\000" +
-    "\004\002\ufffe\001\002\000\004\010\024\001\002\000\010" +
-    "\011\uffef\016\uffef\017\uffef\001\002\000\010\011\030\016" +
-    "\027\017\031\001\002\000\010\011\ufff0\016\ufff0\017\ufff0" +
-    "\001\002\000\004\012\035\001\002\000\006\011\ufff1\015" +
-    "\ufff1\001\002\000\004\012\032\001\002\000\004\025\033" +
-    "\001\002\000\004\004\034\001\002\000\010\011\uffed\016" +
-    "\uffed\017\uffed\001\002\000\004\025\036\001\002\000\004" +
-    "\004\037\001\002\000\010\011\uffee\016\uffee\017\uffee\001" +
-    "\002\000\004\024\056\001\002\000\004\024\042\001\002" +
-    "\000\004\006\043\001\002\000\010\007\ufff8\023\ufff8\024" +
-    "\ufff8\001\002\000\010\007\047\023\050\024\045\001\002" +
-    "\000\004\024\054\001\002\000\010\007\ufff9\023\ufff9\024" +
-    "\ufff9\001\002\000\004\004\053\001\002\000\004\024\051" +
-    "\001\002\000\012\005\052\007\ufff6\023\ufff6\024\ufff6\001" +
-    "\002\000\010\007\ufff7\023\ufff7\024\ufff7\001\002\000\010" +
-    "\011\ufffb\013\ufffb\015\ufffb\001\002\000\012\005\055\007" +
-    "\ufff4\023\ufff4\024\ufff4\001\002\000\010\007\ufff5\023\ufff5" +
-    "\024\ufff5\001\002\000\004\006\057\001\002\000\010\007" +
-    "\ufff8\023\ufff8\024\ufff8\001\002\000\010\007\061\023\050" +
-    "\024\045\001\002\000\004\004\062\001\002\000\010\011" +
-    "\ufffa\013\ufffa\015\ufffa\001\002\000\004\024\065\001\002" +
-    "\000\006\002\uffec\020\uffec\001\002\000\004\021\066\001" +
-    "\002\000\010\005\uffe7\022\uffe7\024\070\001\002\000\006" +
-    "\005\071\022\072\001\002\000\006\005\uffe9\022\uffe9\001" +
-    "\002\000\004\024\076\001\002\000\004\014\073\001\002" +
-    "\000\004\024\074\001\002\000\004\004\075\001\002\000" +
-    "\006\002\uffea\020\uffea\001\002\000\006\005\uffe8\022\uffe8" +
+    "\000\127\000\010\002\uffdf\015\006\022\uffdf\001\002\000" +
+    "\004\002\001\001\002\000\006\002\uffff\022\117\001\002" +
+    "\000\004\016\011\001\002\000\004\002\010\001\002\000" +
+    "\004\002\000\001\002\000\004\026\012\001\002\000\004" +
+    "\012\013\001\002\000\010\013\ufffc\015\ufffc\017\ufffc\001" +
+    "\002\000\010\013\uffe6\015\016\017\uffe6\001\002\000\010" +
+    "\013\ufffd\015\ufffd\017\ufffd\001\002\000\006\025\041\026" +
+    "\040\001\002\000\006\013\022\017\021\001\002\000\006" +
+    "\013\uffe7\017\uffe7\001\002\000\004\026\023\001\002\000" +
+    "\004\002\ufffe\001\002\000\004\012\024\001\002\000\010" +
+    "\013\uffe3\020\uffe3\021\uffe3\001\002\000\010\013\030\020" +
+    "\027\021\031\001\002\000\010\013\uffe4\020\uffe4\021\uffe4" +
+    "\001\002\000\004\014\035\001\002\000\006\013\uffe5\017" +
+    "\uffe5\001\002\000\004\014\032\001\002\000\004\027\033" +
+    "\001\002\000\004\004\034\001\002\000\010\013\uffe1\020" +
+    "\uffe1\021\uffe1\001\002\000\004\027\036\001\002\000\004" +
+    "\004\037\001\002\000\010\013\uffe2\020\uffe2\021\uffe2\001" +
+    "\002\000\004\026\111\001\002\000\004\026\042\001\002" +
+    "\000\004\006\043\001\002\000\010\007\ufff8\025\ufff8\026" +
+    "\ufff8\001\002\000\010\007\046\025\050\026\045\001\002" +
+    "\000\006\010\054\026\055\001\002\000\004\004\053\001" +
+    "\002\000\010\007\ufff9\025\ufff9\026\ufff9\001\002\000\004" +
+    "\026\051\001\002\000\012\005\052\007\ufff6\025\ufff6\026" +
+    "\ufff6\001\002\000\010\007\ufff7\025\ufff7\026\ufff7\001\002" +
+    "\000\010\013\ufffb\015\ufffb\017\ufffb\001\002\000\006\025" +
+    "\060\026\057\001\002\000\012\005\056\007\ufff4\025\ufff4" +
+    "\026\ufff4\001\002\000\010\007\ufff5\025\ufff5\026\ufff5\001" +
+    "\002\000\006\005\075\011\076\001\002\000\006\005\061" +
+    "\011\062\001\002\000\006\025\066\026\065\001\002\000" +
+    "\004\026\063\001\002\000\012\005\064\007\ufff3\025\ufff3" +
+    "\026\ufff3\001\002\000\010\007\uffed\025\uffed\026\uffed\001" +
+    "\002\000\004\011\072\001\002\000\004\011\067\001\002" +
+    "\000\004\026\070\001\002\000\012\005\071\007\ufff1\025" +
+    "\ufff1\026\ufff1\001\002\000\010\007\uffeb\025\uffeb\026\uffeb" +
+    "\001\002\000\004\026\073\001\002\000\012\005\074\007" +
+    "\ufff0\025\ufff0\026\ufff0\001\002\000\010\007\uffea\025\uffea" +
+    "\026\uffea\001\002\000\006\025\102\026\101\001\002\000" +
+    "\004\026\077\001\002\000\012\005\100\007\ufff2\025\ufff2" +
+    "\026\ufff2\001\002\000\010\007\uffec\025\uffec\026\uffec\001" +
+    "\002\000\004\011\106\001\002\000\004\011\103\001\002" +
+    "\000\004\026\104\001\002\000\012\005\105\007\uffef\025" +
+    "\uffef\026\uffef\001\002\000\010\007\uffe9\025\uffe9\026\uffe9" +
+    "\001\002\000\004\026\107\001\002\000\012\005\110\007" +
+    "\uffee\025\uffee\026\uffee\001\002\000\010\007\uffe8\025\uffe8" +
+    "\026\uffe8\001\002\000\004\006\112\001\002\000\010\007" +
+    "\ufff8\025\ufff8\026\ufff8\001\002\000\010\007\114\025\050" +
+    "\026\045\001\002\000\004\004\115\001\002\000\010\013" +
+    "\ufffa\015\ufffa\017\ufffa\001\002\000\006\002\uffe0\022\uffe0" +
+    "\001\002\000\004\026\120\001\002\000\004\023\121\001" +
+    "\002\000\010\005\uffdb\024\uffdb\026\122\001\002\000\006" +
+    "\005\uffdd\024\uffdd\001\002\000\006\005\124\024\125\001" +
+    "\002\000\004\026\131\001\002\000\004\016\126\001\002" +
+    "\000\004\026\127\001\002\000\004\004\130\001\002\000" +
+    "\006\002\uffde\022\uffde\001\002\000\006\005\uffdc\024\uffdc" +
     "\001\002" });
 
   /** Access to parse-action table. */
@@ -99,8 +121,8 @@ public class Parser extends java_cup.runtime.lr_parser {
   /** <code>reduce_goto</code> table. */
   protected static final short[][] _reduce_table = 
     unpackFromStrings(new String[] {
-    "\000\074\000\010\002\006\003\003\014\004\001\001\000" +
-    "\002\001\001\000\004\015\063\001\001\000\002\001\001" +
+    "\000\127\000\010\002\006\003\003\014\004\001\001\000" +
+    "\002\001\001\000\004\015\115\001\001\000\002\001\001" +
     "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
     "\002\001\001\000\004\004\013\001\001\000\006\005\014" +
     "\010\016\001\001\000\002\001\001\000\002\001\001\000" +
@@ -111,15 +133,24 @@ public class Parser extends java_cup.runtime.lr_parser {
     "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
     "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
     "\002\001\001\000\002\001\001\000\004\006\043\001\001" +
-    "\000\004\007\045\001\001\000\002\001\001\000\002\001" +
+    "\000\004\007\046\001\001\000\002\001\001\000\002\001" +
     "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
     "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
-    "\002\001\001\000\002\001\001\000\004\006\057\001\001" +
-    "\000\004\007\045\001\001\000\002\001\001\000\002\001" +
+    "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
+    "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+    "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+    "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
+    "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+    "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+    "\002\001\001\000\002\001\001\000\002\001\001\000\004" +
+    "\006\112\001\001\000\004\007\046\001\001\000\002\001" +
     "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
-    "\000\004\016\066\001\001\000\002\001\001\000\002\001" +
+    "\000\002\001\001\000\004\016\122\001\001\000\002\001" +
     "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
-    "\000\002\001\001\000\002\001\001\000\002\001\001" });
+    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+    "\002\001\001" });
 
   /** Access to <code>reduce_goto</code> table. */
   public short[][] reduce_table() {return _reduce_table;}
@@ -455,7 +486,315 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 14: // capablist ::= capablist capab 
+          case 14: // param ::= IDENT LANG TYPE RANG IDENT 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               int typegenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left;
+               int typegenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).right;
+               Object typegen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm + "<" + typegen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 15: // param ::= IDENT LANG IDENT RANG IDENT 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               int clsgenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left;
+               int clsgenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).right;
+               Object clsgen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm + "<" + clsgen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 16: // param ::= IDENT LANG TYPE COMMA TYPE RANG IDENT 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-6)).value;
+               int typegen1left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).left;
+               int typegen1right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).right;
+               Object typegen1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               int typegen2left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left;
+               int typegen2right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).right;
+               Object typegen2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + typegen1 + "," + typegen2 + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 17: // param ::= IDENT LANG TYPE COMMA IDENT RANG IDENT 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-6)).value;
+               int typegenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).left;
+               int typegenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).right;
+               Object typegen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               int clsgenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left;
+               int clsgenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).right;
+               Object clsgen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + typegen + "," + clsgen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 18: // param ::= IDENT LANG IDENT COMMA TYPE RANG IDENT 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-6)).value;
+               int clsgenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).left;
+               int clsgenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).right;
+               Object clsgen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               int typegenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left;
+               int typegenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).right;
+               Object typegen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + clsgen + "," + typegen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 19: // param ::= IDENT LANG IDENT COMMA IDENT RANG IDENT 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-6)).value;
+               int clsgen1left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).left;
+               int clsgen1right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-4)).right;
+               Object clsgen1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-4)).value;
+               int clsgen2left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left;
+               int clsgen2right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).right;
+               Object clsgen2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.peek()).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + clsgen1 + "," + clsgen2 + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 20: // param ::= IDENT LANG TYPE RANG IDENT COMMA 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               int typegenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
+               int typegenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).right;
+               Object typegen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm + "<" + typegen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 21: // param ::= IDENT LANG IDENT RANG IDENT COMMA 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               int clsgenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
+               int clsgenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).right;
+               Object clsgen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm + "<" + clsgen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 22: // param ::= IDENT LANG TYPE COMMA TYPE RANG IDENT COMMA 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-7)).value;
+               int typegen1left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).left;
+               int typegen1right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).right;
+               Object typegen1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               int typegen2left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
+               int typegen2right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).right;
+               Object typegen2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + typegen1 + "," + typegen2 + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 23: // param ::= IDENT LANG TYPE COMMA IDENT RANG IDENT COMMA 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-7)).value;
+               int typegenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).left;
+               int typegenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).right;
+               Object typegen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               int clsgenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
+               int clsgenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).right;
+               Object clsgen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + typegen + "," + clsgen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 24: // param ::= IDENT LANG IDENT COMMA TYPE RANG IDENT COMMA 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-7)).value;
+               int clsgenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).left;
+               int clsgenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).right;
+               Object clsgen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               int typegenleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
+               int typegenright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).right;
+               Object typegen = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + clsgen + "," + typegen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 25: // param ::= IDENT LANG IDENT COMMA IDENT RANG IDENT COMMA 
+            {
+              ParseNode RESULT =null;
+               int clsprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).left;
+               int clsprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)).right;
+               Object clsprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-7)).value;
+               int clsgen1left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).left;
+               int clsgen1right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-5)).right;
+               Object clsgen1 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-5)).value;
+               int clsgen2left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
+               int clsgen2right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).right;
+               Object clsgen2 = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-3)).value;
+               int idprmleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
+               int idprmright = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).right;
+               Object idprm = (Object)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-1)).value;
+               
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + clsgen1 + "," + clsgen2 + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       
+              CUP$Parser$result = parser.getSymbolFactory().newSymbol("param",5, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-7)), ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()), RESULT);
+            }
+          return CUP$Parser$result;
+
+          /*. . . . . . . . . . . . . . . . . . . .*/
+          case 26: // capablist ::= capablist capab 
             {
               ParseNode RESULT =null;
                int clleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
@@ -473,7 +812,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 15: // capablist ::= 
+          case 27: // capablist ::= 
             {
               ParseNode RESULT =null;
                
@@ -485,7 +824,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 16: // capab ::= CAPABILITY IDENT BEGIN capabcont END 
+          case 28: // capab ::= CAPABILITY IDENT BEGIN capabcont END 
             {
               ParseNode RESULT =null;
                int idcapleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
@@ -505,7 +844,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 17: // capabcont ::= capabcont cont 
+          case 29: // capabcont ::= capabcont cont 
             {
               ParseNode RESULT =null;
                int ccontleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
@@ -523,7 +862,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 18: // capabcont ::= 
+          case 30: // capabcont ::= 
             {
               ParseNode RESULT =null;
                
@@ -535,7 +874,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 19: // cont ::= DESCRIPTION ASSIGN STRINGCONST SEMICOLON 
+          case 31: // cont ::= DESCRIPTION ASSIGN STRINGCONST SEMICOLON 
             {
               ParseNode RESULT =null;
                int dscleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
@@ -554,7 +893,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 20: // cont ::= METHOD ASSIGN STRINGCONST SEMICOLON 
+          case 32: // cont ::= METHOD ASSIGN STRINGCONST SEMICOLON 
             {
               ParseNode RESULT =null;
                int mtdleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-3)).left;
@@ -573,7 +912,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 21: // reqlist ::= reqlist require 
+          case 33: // reqlist ::= reqlist require 
             {
               ParseNode RESULT =null;
                int rlleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-1)).left;
@@ -591,7 +930,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 22: // reqlist ::= 
+          case 34: // reqlist ::= 
             {
               ParseNode RESULT =null;
                
@@ -603,7 +942,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 23: // require ::= REQUIRES IDENT WITH capintlist AS INTERFACE IDENT SEMICOLON 
+          case 35: // require ::= REQUIRES IDENT WITH capintlist AS INTERFACE IDENT SEMICOLON 
             {
               ParseNode RESULT =null;
                int idintleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-6)).left;
@@ -627,7 +966,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 24: // capintlist ::= IDENT 
+          case 36: // capintlist ::= IDENT 
             {
               ParseNode RESULT =null;
                int idcapleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.peek()).left;
@@ -643,7 +982,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 25: // capintlist ::= capintlist COMMA IDENT 
+          case 37: // capintlist ::= capintlist COMMA IDENT 
             {
               ParseNode RESULT =null;
                int cilleft = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left;
@@ -661,7 +1000,7 @@ class CUP$Parser$actions {
           return CUP$Parser$result;
 
           /*. . . . . . . . . . . . . . . . . . . .*/
-          case 26: // capintlist ::= 
+          case 38: // capintlist ::= 
             {
               ParseNode RESULT =null;
                
index e299639..b726278 100644 (file)
@@ -7,24 +7,26 @@ package iotpolicy.parser;
 /** CUP generated interface containing symbol constants. */
 public interface sym {
   /* terminals */
-  public static final int IDENT = 18;
+  public static final int IDENT = 20;
   public static final int SEMICOLON = 2;
-  public static final int STRINGCONST = 19;
-  public static final int REQUIRES = 14;
-  public static final int END = 7;
-  public static final int CAPABILITY = 11;
-  public static final int AS = 16;
-  public static final int WITH = 15;
-  public static final int PUBLIC = 9;
-  public static final int BEGIN = 6;
-  public static final int TYPE = 17;
-  public static final int DESCRIPTION = 12;
+  public static final int STRINGCONST = 21;
+  public static final int REQUIRES = 16;
+  public static final int RANG = 7;
+  public static final int END = 9;
+  public static final int CAPABILITY = 13;
+  public static final int LANG = 6;
+  public static final int AS = 18;
+  public static final int WITH = 17;
+  public static final int PUBLIC = 11;
+  public static final int BEGIN = 8;
+  public static final int TYPE = 19;
+  public static final int DESCRIPTION = 14;
   public static final int COMMA = 3;
   public static final int EOF = 0;
-  public static final int METHOD = 13;
+  public static final int METHOD = 15;
   public static final int error = 1;
-  public static final int INTERFACE = 10;
-  public static final int ASSIGN = 8;
+  public static final int INTERFACE = 12;
+  public static final int ASSIGN = 10;
   public static final int RPAR = 5;
   public static final int LPAR = 4;
   public static final String[] terminalNames = new String[] {
@@ -34,6 +36,8 @@ public interface sym {
   "COMMA",
   "LPAR",
   "RPAR",
+  "LANG",
+  "RANG",
   "BEGIN",
   "END",
   "ASSIGN",
index a646e62..51da7b7 100644 (file)
@@ -124,6 +124,13 @@ public class InterfaceDecl {
        public String getMethodId(String method) {
 
                int index = listMethods.indexOf(method);
+               // If index=-1, it means that it's not found.
+               // There is perhaps a discrepancy in the policy file
+               //              between the method signatures in the interface 
+               //              and capability sections
+               if (index == -1)
+                       throw new Error("InterfaceDecl: Discrepancies in method signature for " + 
+                               method + "! Please check your policy file...");
                return listMethodIds.get(index);
        }
 
@@ -134,6 +141,13 @@ public class InterfaceDecl {
        public String getMethodType(String method) {
 
                int index = listMethods.indexOf(method);
+               // If index=-1, it means that it's not found.
+               // There is perhaps a discrepancy in the policy file
+               //              between the method signatures in the interface 
+               //              and capability sections
+               if (index == -1)
+                       throw new Error("InterfaceDecl: Discrepancies in method signature for " + 
+                               method + "! Please check your policy file...");
                return listMethodTypes.get(index);
        }
 
@@ -144,6 +158,13 @@ public class InterfaceDecl {
        public List<String> getMethodParams(String method) {
 
                int index = listMethods.indexOf(method);
+               // If index=-1, it means that it's not found.
+               // There is perhaps a discrepancy in the policy file
+               //              between the method signatures in the interface 
+               //              and capability sections
+               if (index == -1)
+                       throw new Error("InterfaceDecl: Discrepancies in method signature for " + 
+                               method + "! Please check your policy file...");
                return listMethodParams.get(index);
        }
        
@@ -154,6 +175,13 @@ public class InterfaceDecl {
        public List<String> getMethodParamTypes(String method) {
 
                int index = listMethods.indexOf(method);
+               // If index=-1, it means that it's not found.
+               // There is perhaps a discrepancy in the policy file
+               //              between the method signatures in the interface 
+               //              and capability sections
+               if (index == -1)
+                       throw new Error("InterfaceDecl: Discrepancies in method signature for " + 
+                               method + "! Please check your policy file...");
                return listMethodParamTypes.get(index);
        }
 
index ff3b02f..c6c9f6d 100644 (file)
@@ -24,7 +24,7 @@ parser code {:
   }
 :};
 
-terminal SEMICOLON, COMMA, LPAR, RPAR, BEGIN, END, ASSIGN;
+terminal SEMICOLON, COMMA, LPAR, RPAR, LANG, RANG, BEGIN, END, ASSIGN;
 terminal PUBLIC, INTERFACE, CAPABILITY, DESCRIPTION, METHOD, REQUIRES, WITH, AS; 
 terminal TYPE;
 terminal IDENT, STRINGCONST;
@@ -141,6 +141,103 @@ param      ::= TYPE:typeprm IDENT:idprm COMMA
                pn.addChild("param_ident").setLiteral(idprm);
                RESULT = pn;
        :}
+       /* generic/template with one type, e.g. set<int> */
+    | IDENT:clsprm LANG TYPE:typegen RANG IDENT:idprm
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm + "<" + typegen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+    | IDENT:clsprm LANG IDENT:clsgen RANG IDENT:idprm
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm + "<" + clsgen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+       /* generic/template with two types, e.g. map<int,string> */
+    | IDENT:clsprm LANG TYPE:typegen1 COMMA TYPE:typegen2 RANG IDENT:idprm
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + typegen1 + "," + typegen2 + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+    | IDENT:clsprm LANG TYPE:typegen COMMA IDENT:clsgen RANG IDENT:idprm
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + typegen + "," + clsgen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+    | IDENT:clsprm LANG IDENT:clsgen COMMA TYPE:typegen RANG IDENT:idprm
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + clsgen + "," + typegen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+    | IDENT:clsprm LANG IDENT:clsgen1 COMMA IDENT:clsgen2 RANG IDENT:idprm
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + clsgen1 + "," + clsgen2 + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+       /* Add comma at the end... */
+       /* generic/template with one type, e.g. set<int> */
+    | IDENT:clsprm LANG TYPE:typegen RANG IDENT:idprm COMMA
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm + "<" + typegen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+    | IDENT:clsprm LANG IDENT:clsgen RANG IDENT:idprm COMMA
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm + "<" + clsgen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+       /* generic/template with two types, e.g. map<int,string> */
+    | IDENT:clsprm LANG TYPE:typegen1 COMMA TYPE:typegen2 RANG IDENT:idprm COMMA
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + typegen1 + "," + typegen2 + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+    | IDENT:clsprm LANG TYPE:typegen COMMA IDENT:clsgen RANG IDENT:idprm COMMA
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + typegen + "," + clsgen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+    | IDENT:clsprm LANG IDENT:clsgen COMMA TYPE:typegen RANG IDENT:idprm COMMA
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + clsgen + "," + typegen + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
+    | IDENT:clsprm LANG IDENT:clsgen1 COMMA IDENT:clsgen2 RANG IDENT:idprm COMMA
+       {:
+               ParseNode pn = new ParseNode("param");
+               pn.addChild("param_class").setLiteral((String)clsprm 
+                       + "<" + clsgen1 + "," + clsgen2 + ">");
+               pn.addChild("param_ident").setLiteral(idprm);
+               RESULT = pn;
+       :}
     ;
 
 //2) List of capabilities and their respective contents, i.e. description, method, etc.
index a9e70d1..239c81d 100644 (file)
@@ -52,7 +52,7 @@ import java_cup.runtime.ComplexSymbolFactory.Location;
 %eofval}
 
 
-Ident = [a-zA-Z$_] [a-zA-Z0-9$_<>]*
+Ident = [a-zA-Z$_] [a-zA-Z0-9$_]*
 
 new_line = \r|\n|\r\n;
 
@@ -104,6 +104,8 @@ white_space = {new_line} | [ \t\f]
 ","               { return symbol("comma",COMMA); }
 "("               { return symbol("(",LPAR); }
 ")"               { return symbol(")",RPAR); }
+"<"               { return symbol("<",LANG); }
+">"               { return symbol(">",RANG); }
 "{"               { return symbol("{",BEGIN); }
 "}"               { return symbol("}",END); }
 "="               { return symbol("=",ASSIGN); }