Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/59-object-storage-pilot

Tagging.mc4 3.06 KB
Newer Older
vonWenckstern's avatar
vonWenckstern committed
1 2 3 4 5 6 7 8 9
package de.monticore.lang;

/**
 * Basic grammar to tag non-functional properties
 *
 * @author Michael von Wenckstern
 */
grammar Tagging extends de.monticore.common.Common {

10
  TaggingUnit =
vonWenckstern's avatar
vonWenckstern committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
    ("package" package:(Name& || ".")+ ";")? 
    (ImportStatement)*
    "conforms" "to" (QualifiedName || ",")+ ";"
	TagBody;
	
	// name should be optional, but than we need an transformation step in the parser
	// b/c the symbol table needs a name
	// and we need the symbol table for coco checks
	// maybe later for convience we make the optional
	TagBody = "tags" Name? ("for" targetModel: Scope)? "{"
	   Tag+ "}";
	   
//	interface TagElement;
	
  Tag = "tag" (Scope || ",")+ "with" TagElement+;
26
  symbol TagElement = Name (TagValue | ";");
vonWenckstern's avatar
vonWenckstern committed
27 28 29 30 31 32 33 34

 fragment token WSS = (' ' | '\t' | '\r' | '\n');

 token TagValue = '=' WSS* BasicTagValue (WSS* ';');
 fragment token BasicTagValue = (Recursion | TagToken | String);
 fragment token Recursion = '{' (~('{' | '}' | '"') | String | Recursion)+ '}';
 fragment token TagToken = (~('"' | '{' | '}' | ';'))+;

35
 NameWithArray = (Name ("[" start:IntLiteral (( ":" step:IntLiteral )? ":" end:IntLiteral )?"]")?);
36 37
 ast NameWithArray =
    method public String toString(){
38 39 40 41 42 43 44
        String arrayPart = "";

        arrayPart += start.isPresent() ? "" + start.get().getValue() : "";
        arrayPart += step.isPresent() ? ":" + step.get().getValue() : "";
        arrayPart += end.isPresent() ? ":" + end.get().getValue() : "";

        return name + (arrayPart.equals("") ? "" : "[" + arrayPart + "]");
45 46
    };

47
 QualifiedNameWithArray = parts:( NameWithArray || ".")+;
48 49
 ast QualifiedNameWithArray =
    method public String toString(){
50
        return de.se_rwth.commons.Joiners.DOT.join(getParts());
51 52 53
    };


vonWenckstern's avatar
vonWenckstern committed
54 55 56 57 58 59 60 61 62 63
	interface Scope;
	ast Scope =
	  method public String getQualifiedNameString() {
     return "";
    }
	  method public String getScopeKind() {
	    return "undefined";
	  };

	// this one is only defined here, to get Parser Tags
64
	NameScope implements Scope = qualifiedName:QualifiedNameWithArray;
vonWenckstern's avatar
vonWenckstern committed
65 66
	ast NameScope =
	  method public String getQualifiedNameString() {
67
       return getQualifiedName().toString();
vonWenckstern's avatar
vonWenckstern committed
68 69 70 71 72
     }
	  method public String getScopeKind() {
  	  return "NameScope";
  	};

73
	ConnectorScope extends NameScope = source:QualifiedNameWithArray "->" qualifiedName:QualifiedNameWithArray;
vonWenckstern's avatar
vonWenckstern committed
74 75
  ast ConnectorScope =
    method public String getQualifiedNameString() {
76
       return getQualifiedName().toString();
vonWenckstern's avatar
vonWenckstern committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
     }
    method public String getScopeKind() {
      return "ConnectorScope";
    };

/* ast Scope =
  method public de.monticore.types.types._ast.ASTQualifiedName getQualifiedName() {
   return null;
  }
  method public String getQualifiedNameAsString() {
     return de.se_rwth.commons.Joiners.DOT.join(getQualifiedName().getParts());
  };
  ast NameScope =
  method public String getQualifiedNameAsString() {
     return de.se_rwth.commons.Joiners.DOT.join(getQualifiedName().getParts());
  };
  ast ConnectorScope =
    method public String getQualifiedNameAsString() {
       return de.se_rwth.commons.Joiners.DOT.join(getQualifiedName().getParts());
    }; */
}