From 5d955a0c2ea1ce652bcf80f6e2e41a2d0fe246ee Mon Sep 17 00:00:00 2001
From: Sven Gestegard Robertz <sven.robertz@cs.lth.se>
Date: Wed, 29 Apr 2015 17:17:41 +0200
Subject: [PATCH] added empty intention list to type expressions

---
 compiler/2014/LabComm.ast          |  5 ++++-
 compiler/2014/LabCommParser.parser | 10 ++++++----
 compiler/2014/Refactoring.jrag     |  7 ++++++-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast
index 3e1015e..ccda16a 100644
--- a/compiler/2014/LabComm.ast
+++ b/compiler/2014/LabComm.ast
@@ -2,7 +2,7 @@ Specification ::= Decl*;
 
 abstract Decl ::= TypeInstance /Signature/;
 
-TypeInstance ::= DataType <Name:String>;
+TypeInstance ::= DataType <Name:String> Intention*;
 
 TypeDecl   : Decl;
 SampleDecl : Decl;
@@ -29,6 +29,9 @@ UserType           : DataType ::= <Name:String>;
 StructType         : DataType ::= Field*;
 ParseArrayType     : DataType ::= DataType Dim*;
 abstract ArrayType : DataType ::= DataType Exp*;
+
+Intention ::= <Key:String> <Value:String>;
+
 VariableArrayType  : ArrayType;
 FixedArrayType     : ArrayType;
 
diff --git a/compiler/2014/LabCommParser.parser b/compiler/2014/LabCommParser.parser
index 3a5d774..612320a 100644
--- a/compiler/2014/LabCommParser.parser
+++ b/compiler/2014/LabCommParser.parser
@@ -54,14 +54,16 @@ List var_decl_list =
   | var_decl_list.l var_decl.v      {: return l.add(v); :}
   ;
 
+List intentions = {: return new List(); :}
+
 TypeInstance type_instance =
-    type.t IDENTIFIER {: return new TypeInstance(t, IDENTIFIER); :}
-  | type.t IDENTIFIER dim_list.d
-    {: return new TypeInstance(new ParseArrayType(t, d), IDENTIFIER); :}
+    intentions.i type.t IDENTIFIER {: return new TypeInstance(t, IDENTIFIER, i); :}
+  | intentions.i type.t IDENTIFIER dim_list.d
+    {: return new TypeInstance(new ParseArrayType(t, d), IDENTIFIER, i); :}
   ;
 
 Field var_decl =
-    concrete_type.t SEMICOLON     {: return new Field(t); :}
+    type_instance.t SEMICOLON     {: return new Field(t); :}
   ;
 
 TypeDecl type_decl =
diff --git a/compiler/2014/Refactoring.jrag b/compiler/2014/Refactoring.jrag
index 9f0d20c..fbe083f 100644
--- a/compiler/2014/Refactoring.jrag
+++ b/compiler/2014/Refactoring.jrag
@@ -4,6 +4,11 @@ aspect Refactoring {
     syn DataType Decl.getDataType() = getTypeInstance().getDataType();
 
     public Field.Field(TypeInstance t) {
-        this(t.getDataType(), t.getName());
+        this(t.getDataType(), t.getName(), t.getAnnotationList());
+    }
+
+    public TypeInstance.TypeInstance(DataType t, String n) {
+        this(t, n, new  List<Annotation>());
+        System.out.println("WARNING! TypeInstance(DataType, String) ignoring intention list");
     }
 }
-- 
GitLab