diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast index 3e1015e27cd75d5e632bbf42e39d575b65c280f5..ccda16afb98d05e1d00d9aeefe58fa691eadec8f 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 3a5d77423c2b590472ac32e1e6bea35df19cdd1e..612320a89feeacbdd4bf7dd77b7732c19caf0b9d 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 9f0d20c9c85f5c34631189b7e685b2d1b40031ae..fbe083fbce28e76fe15a8c1c4f60c037f0601eb5 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"); } }