diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast index a8f335b910f3bfd49c811e03d39d8d5657fc56be..f1fd5c039f5fbed6070a56dc1287f8ad9dd934c6 100644 --- a/compiler/2014/LabComm.ast +++ b/compiler/2014/LabComm.ast @@ -4,8 +4,6 @@ abstract Decl ::= TypeInstance /Signature/; TypeInstance ::= DataType <Name:String> Intention*; -Intention ::= <Key:String> <Value:String>; - TypeDecl : Decl; SampleDecl : Decl; @@ -21,6 +19,13 @@ IntSignatureLine : DataSignatureLine ::= <Data:int>; StringSignatureLine : DataSignatureLine ::= <Data:String>; TypeRefSignatureLine : SignatureLine ::= Decl; +Annotation ::= <Key:String> <Value:String>; + +Intention : Annotation; +DocString : Annotation; + +TypeInstance ::= DataType <Name:String> Annotation*; + Field : TypeInstance; abstract DataType; diff --git a/compiler/2014/LabCommParser.parser b/compiler/2014/LabCommParser.parser index 812e72578004628f79d83bcdf6b2dd0b06cc2093..3575ee283662dc35010fe45e0351b8d71aaded3f 100644 --- a/compiler/2014/LabCommParser.parser +++ b/compiler/2014/LabCommParser.parser @@ -67,7 +67,7 @@ List intention_list = String key = IDENTIFIER; String stringliteral = IDENTIFIER; -Intention intention = LPAREN key.k COLON stringliteral.v RPAREN {: return new Intention(k,v); :}; +Annotation intention = LPAREN key.k COLON stringliteral.v RPAREN {: return new Annotation(k,v); :}; TypeInstance type_instance = intentions.i type.t IDENTIFIER {: return new TypeInstance(t, IDENTIFIER, i); :} diff --git a/compiler/2014/Refactoring.jrag b/compiler/2014/Refactoring.jrag index 4a2609c6f95eb21bcd0b1e85ecb6dc65ff690be3..fbe083fbce28e76fe15a8c1c4f60c037f0601eb5 100644 --- a/compiler/2014/Refactoring.jrag +++ b/compiler/2014/Refactoring.jrag @@ -4,11 +4,11 @@ aspect Refactoring { syn DataType Decl.getDataType() = getTypeInstance().getDataType(); public Field.Field(TypeInstance t) { - this(t.getDataType(), t.getName(), t.getIntentionList()); + this(t.getDataType(), t.getName(), t.getAnnotationList()); } public TypeInstance.TypeInstance(DataType t, String n) { - this(t, n, new List<Intention>()); + this(t, n, new List<Annotation>()); System.out.println("WARNING! TypeInstance(DataType, String) ignoring intention list"); } } diff --git a/compiler/2014/Signature.jrag b/compiler/2014/Signature.jrag index 96231d1a4a498e7b31e3762bda6e34b5153529f3..89010e75c4971d9efbbf0f05dd16a1c24e3cb108 100644 --- a/compiler/2014/Signature.jrag +++ b/compiler/2014/Signature.jrag @@ -1,12 +1,12 @@ import java.util.*; -aspect Intentions { +aspect Annotations { inh Decl TypeInstance.parentDecl(); - coll Set Decl.allIntentions() [new HashSet()] with add; - TypeInstance contributes getIntentionString() - to Decl.allIntentions() + coll Set Decl.allAnnotations() [new HashSet()] with add; + TypeInstance contributes getAnnotationString() + to Decl.allAnnotations() for parentDecl(); } @@ -25,11 +25,11 @@ aspect Signature { inh Decl SignatureList.parentDecl(); /// TESTING - syn String Decl.getIntentionString() { + syn String Decl.getAnnotationString() { StringBuilder sb = new StringBuilder(); - Iterator<String> iti = allIntentions().iterator(); + Iterator<String> iti = allAnnotations().iterator(); while(iti.hasNext()) { - //Intention i = iti.next(); + //Annotation i = iti.next(); //sb.append("("+i.getKey()+" : "+i.getValue()+") "); String i = iti.next(); sb.append(i); @@ -37,22 +37,22 @@ aspect Signature { return sb.toString(); } - syn String TypeInstance.getIntentionString() { + syn String TypeInstance.getAnnotationString() { StringBuilder sb = new StringBuilder(); - List<Intention> ints = getIntentionList(); - for(Intention i : ints) { + List<Annotation> ints = getAnnotationList(); + for(Annotation i : ints) { sb.append("("+i.getKey()+" : "+i.getValue()+") "); } return sb.toString(); } - public void Decl.debugIntentions() { - System.out.println("Decl.intentions: " + getIntentionString()); + public void Decl.debugAnnotations() { + System.out.println("Decl.annotations: " + getAnnotationString()); } // TESTING END syn nta Signature Decl.getSignature() { - debugIntentions(); + debugAnnotations(); SignatureList sl = new SignatureList(); genSigLineForDecl(sl, true); SignatureList fsl = new SignatureList();