Fixed non-templated classes, which I broke along the way...the semantics now run...
authorJonathan Lifflander <jliffl2@illinois.edu>
Mon, 19 Apr 2010 16:34:23 +0000 (11:34 -0500)
committerJonathan Lifflander <jliffl2@illinois.edu>
Mon, 19 Apr 2010 16:34:23 +0000 (11:34 -0500)
src/langs/charj/src/charj/translator/CharjSemantics.g
src/langs/charj/src/charj/translator/ClassSymbol.java

index a08d0a07e8cfb17f06d42dd95bd5201c39cb73de..7c2412f87bfb3285145066512dc4c89014ce293e 100644 (file)
@@ -119,9 +119,13 @@ importDeclarations returns [List<CharjAST> packageNames]
 
 typeDeclaration[List<CharjAST> imports] returns [ClassSymbol sym]
 scope ScopeStack; // top-level type scope
-    :   ^('template' i1=IDENT* ^('class' i2=IDENT (^('extends' type))? (^('implements' type+))? classScopeDeclaration*))
+    :   ^('template'? i1=IDENT* ^('class' i2=IDENT (^('extends' type))? (^('implements' type+))? classScopeDeclaration*))
+        {
+            // JL: Need to fill the templateArgs in ClassSymbol, and push this down
+            // to the class subtree
+        }
+    |   ^('class' i2=IDENT (^('extends' type))? (^('implements' type+))? classScopeDeclaration*)
         {
-            // JL: Need to fill the templateArgs in ClassSymbol
             Scope outerScope = $ScopeStack[-1]::current;
             $sym = new ClassSymbol(symtab, $i2.text, null, outerScope);
             outerScope.define($sym.name, $sym);
index 270c1901798997e088858bcaca4b80a896c50340..eadb958c06ff677d122f844c795be96e9b075705 100644 (file)
@@ -7,6 +7,7 @@ public class ClassSymbol extends SymbolWithScope implements Scope {
 
     public ClassSymbol superClass;
     public List<String> interfaceImpls;
+    public List<String> templateArgs;
 
     Map<String, PackageScope> imports = 
         new LinkedHashMap<String, PackageScope>();