diff --git a/compiler/2014/Annotations.jrag b/compiler/2014/Annotations.jrag index 3533f8e7e2746577d25a37b77783ab0aa5095b4a..86166045c13cf5aa6e99899e9e665c609ce1d15c 100644 --- a/compiler/2014/Annotations.jrag +++ b/compiler/2014/Annotations.jrag @@ -5,8 +5,9 @@ aspect Annotations { syn boolean Annotation.isIntention() = false; eq Intention.isIntention() = true; - inh TypeInstance Annotation.parentInstance(); + inh ASTNode Annotation.parentInstance(); eq TypeInstance.getAnnotation(int i).parentInstance() = this; + eq Decl.getAnnotation(int i).parentInstance() = this; coll Set<Intention> TypeInstance.intentionSet() [new HashSet<Intention>()] with add; diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast index f2c73dda71b58ce817f0fd646ca9b2cd56977bd3..311cac4308636e11b0fbd97d58d8a7c3dece283b 100644 --- a/compiler/2014/LabComm.ast +++ b/compiler/2014/LabComm.ast @@ -1,6 +1,6 @@ Specification ::= Decl*; -abstract Decl ::= TypeInstance /Signature/; +abstract Decl ::= TypeInstance Annotation* /Signature/; TypeInstance ::= DataType <Name:String> Annotation*; diff --git a/compiler/2014/LabCommParser.parser b/compiler/2014/LabCommParser.parser index 73f80804c042c9e69e3e154d6d769b00516e07cc..6624635d2d813d63a14b93f47ad575073434572b 100644 --- a/compiler/2014/LabCommParser.parser +++ b/compiler/2014/LabCommParser.parser @@ -82,10 +82,10 @@ Field var_decl = ; TypeDecl type_decl = - TYPEDEF type_instance.t SEMICOLON {: return new TypeDecl(t); :} ; + annotations.a TYPEDEF type_instance.t SEMICOLON {: return new TypeDecl(t, a); :} ; SampleDecl sample_decl = - SAMPLE type_instance.t SEMICOLON {: return new SampleDecl(t); :} ; + annotations.a SAMPLE type_instance.t SEMICOLON {: return new SampleDecl(t, a); :} ; DataType type = prim_type.p {: return p; :} diff --git a/compiler/2014/Refactoring.jrag b/compiler/2014/Refactoring.jrag index fbe083fbce28e76fe15a8c1c4f60c037f0601eb5..84f3484cae000ba22bd387a8f4e1a907ea5a1611 100644 --- a/compiler/2014/Refactoring.jrag +++ b/compiler/2014/Refactoring.jrag @@ -11,4 +11,12 @@ aspect Refactoring { this(t, n, new List<Annotation>()); System.out.println("WARNING! TypeInstance(DataType, String) ignoring intention list"); } + public TypeDecl.TypeDecl(TypeInstance t) { + this(t, new List<Annotation>()); + System.out.println("WARNING! TypeDecl(TypeInstance) ignoring intention list"); + } + public SampleDecl.SampleDecl(TypeInstance t) { + this(t, new List<Annotation>()); + System.out.println("WARNING! SampleDecl(TypeInstance) ignoring intention list"); + } }