Die Migration der Bereiche "Docker Registry" und "Artifiacts" ist fast abgeschlossen. Die letzten Daten werden im Laufe des heutigen Abend (05.08.2021) noch vollständig hochgeladen. Das Anlegen neuer Images und Artifacts funktioniert bereits wieder.

Tagging.mc4 3.12 KB
Newer Older
Bernhard Rumpe's avatar
BR-sy  
Bernhard Rumpe committed
1
/* (c) https://github.com/MontiCore/monticore */
vonWenckstern's avatar
vonWenckstern committed
2
3
4
5
6
7
8
9
package de.monticore.lang;

/**
 * Basic grammar to tag non-functional properties
 *
 */
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
        String arrayPart = "";

40
41
42
        arrayPart += getStartOpt().isPresent() ? "" + getStartOpt().get().getValue() : "";
        arrayPart += getStepOpt().isPresent() ? ":" + getStepOpt().get().getValue() : "";
        arrayPart += getEndOpt().isPresent() ? ":" + getEndOpt().get().getValue() : "";
43
44

        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(getPartsList());
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
     }
    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());
    }; */
Bernhard Rumpe's avatar
BR-sy  
Bernhard Rumpe committed
97
}