diff --git a/compiler/2014/Annotations.jrag b/compiler/2014/Annotations.jrag index ea43c4656852636448dd52d955a378ab05e2beb6..0f6b2f2a762482ace282e421c03e6785e0e904fa 100644 --- a/compiler/2014/Annotations.jrag +++ b/compiler/2014/Annotations.jrag @@ -17,12 +17,12 @@ aspect Annotations { syn boolean Annotation.isIntention() = false; eq Intention.isIntention() = true; - inh AnnotatedNode Annotation.parentInstance(); - eq AnnotatedNode.getAnnotations().parentInstance() = this; + inh TypeInstance Annotation.parentInstance(); + eq TypeInstance.getAnnotations().parentInstance() = this; - coll Set<Intention> AnnotatedNode.intentionSet() [new HashSet<Intention>()] with add; + coll Set<Intention> TypeInstance.intentionSet() [new HashSet<Intention>()] with add; Intention contributes this - to AnnotatedNode.intentionSet() + to TypeInstance.intentionSet() for parentInstance(); } diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast index 92d2aab530dee892007fc1b9d91f5810238e8c3b..6f3c02c4f0b6cf960c5bd9bafe3893a9da015cdc 100644 --- a/compiler/2014/LabComm.ast +++ b/compiler/2014/LabComm.ast @@ -1,9 +1,8 @@ Specification ::= Decl*; -abstract AnnotatedNode ::= Annotations; -abstract Decl : AnnotatedNode ::= TypeInstance /Signature/; +abstract Decl ::= TypeInstance /Signature/; -TypeInstance :AnnotatedNode ::= DataType; +TypeInstance ::= DataType Annotations; Annotations ::= Annotation*; Annotation ::= <Key:String> <Value:byte[]>; diff --git a/compiler/2014/LabCommParser.parser b/compiler/2014/LabCommParser.parser index 8daff77e8c58cd896c49462b948351a5caf0482f..8c03350ab013309671a610a3547665a03e51c16c 100644 --- a/compiler/2014/LabCommParser.parser +++ b/compiler/2014/LabCommParser.parser @@ -82,10 +82,10 @@ Field var_decl = ; TypeDecl type_decl = - annotations.a TYPEDEF type_instance.t SEMICOLON {: return new TypeDecl(t, a); :} ; + TYPEDEF type_instance.t SEMICOLON {: return new TypeDecl(t); :} ; SampleDecl sample_decl = - annotations.a SAMPLE type_instance.t SEMICOLON {: return new SampleDecl(t, a); :} ; + SAMPLE type_instance.t SEMICOLON {: return new SampleDecl(t); :} ; DataType type = prim_type.p {: return p; :} diff --git a/compiler/2014/Refactoring.jrag b/compiler/2014/Refactoring.jrag index 42eceada0ed3baa51c4af910ac9c306c701cf1b9..2e669397ad65eaf30ae926a9d4b4051c5d8da537 100644 --- a/compiler/2014/Refactoring.jrag +++ b/compiler/2014/Refactoring.jrag @@ -5,22 +5,6 @@ aspect Refactoring { syn String TypeInstance.getName() = getAnnotations().getName(); - public TypeDecl.TypeDecl(TypeInstance t, Annotations a) { - this(a, t); - } - - public SampleDecl.SampleDecl(TypeInstance t, Annotations a) { - this(a, t); - } - - public TypeInstance.TypeInstance(DataType t, Annotations a) { - this(a, t); - } - - public Field.Field(DataType t, Annotations a) { - this(a, t); - } - public Annotations Annotations.addName(String n) { //XXX TODO: check if name already exists addAnnotation(new Annotation("",n.getBytes())); @@ -39,15 +23,5 @@ aspect Refactoring { this(t, new Annotations().addName(n)); System.out.println("WARNING! TypeInstance(DataType, String) ignoring intention list"); } - public TypeDecl.TypeDecl(TypeInstance t) { - this(t, new Annotations()); - System.out.println("WARNING! TypeDecl(TypeInstance) ignoring intention list"); - } - public SampleDecl.SampleDecl(TypeInstance t) { - this(t, new Annotations()); - System.out.println("WARNING! SampleDecl(TypeInstance) ignoring intention list"); - } - - syn Annotation Decl.getAnnotation(int i) = getAnnotations().getAnnotation(i); syn Annotation TypeInstance.getAnnotation(int i) = getAnnotations().getAnnotation(i); } diff --git a/examples/user_types/test.lc b/examples/user_types/test.lc index 353877fcf90f0ec65931e320c8820390d10771c0..fdc9d54d50248a29bca973f482a79586b44b32da 100644 --- a/examples/user_types/test.lc +++ b/examples/user_types/test.lc @@ -28,7 +28,7 @@ typedef struct { boolean c; } foo; -(nisse:hej) sample struct { +sample struct { (name:l1)line l1; (name:l2)line l2; (b:"kalle anka")(c:hejdu)(a:"kalle anka")foo f;