Commit 0661c85c authored by Johannes Mey's avatar Johannes Mey
Browse files

use generated navigation attributes

parent 7f751009
aspect Navigation {
/** Tests if Comment is a WhitespaceComment.
* @return 'true' if this is a WhitespaceComment, otherwise 'false'
*/
syn boolean Comment.isWhitespaceComment() = false;
eq WhitespaceComment.isWhitespaceComment() = true;
/** Tests if Comment is a SingleLineComment.
* @return 'true' if this is a SingleLineComment, otherwise 'false'
*/
syn boolean Comment.isSingleLineComment() = false;
eq SingleLineComment.isSingleLineComment() = true;
/** Tests if Comment is a MultiLineComment.
* @return 'true' if this is a MultiLineComment, otherwise 'false'
*/
syn boolean Comment.isMultiLineComment() = false;
eq MultiLineComment.isMultiLineComment() = true;
/** Tests if Comment is a DocComment.
* @return 'true' if this is a DocComment, otherwise 'false'
*/
syn boolean Comment.isDocComment() = false;
eq DocComment.isDocComment() = true;
/** Tests if DirectedRelation is a LeftDirectedRelation.
* @return 'true' if this is a LeftDirectedRelation, otherwise 'false'
*/
syn boolean DirectedRelation.isLeftDirectedRelation() = false;
eq LeftDirectedRelation.isLeftDirectedRelation() = true;
/** Tests if DirectedRelation is a RightDirectedRelation.
* @return 'true' if this is a RightDirectedRelation, otherwise 'false'
*/
syn boolean DirectedRelation.isRightDirectedRelation() = false;
eq RightDirectedRelation.isRightDirectedRelation() = true;
/** Tests if TypeComponent is a NormalComponent.
* @return 'true' if this is a NormalComponent, otherwise 'false'
*/
syn boolean TypeComponent.isNormalComponent() = false;
eq NormalComponent.isNormalComponent() = true;
/** Tests if TypeComponent is a ListComponent.
* @return 'true' if this is a ListComponent, otherwise 'false'
*/
syn boolean TypeComponent.isListComponent() = false;
eq ListComponent.isListComponent() = true;
/** Tests if TypeComponent is a OptComponent.
* @return 'true' if this is a OptComponent, otherwise 'false'
*/
syn boolean TypeComponent.isOptComponent() = false;
eq OptComponent.isOptComponent() = true;
/** Tests if Grammar is a GrammarFile.
* @return 'true' if this is a GrammarFile, otherwise 'false'
*/
syn boolean Grammar.isGrammarFile() = false;
eq GrammarFile.isGrammarFile() = true;
/** Tests if NavigableRole is a NormalRole.
* @return 'true' if this is a NormalRole, otherwise 'false'
*/
syn boolean NavigableRole.isNormalRole() = false;
eq NormalRole.isNormalRole() = true;
/** Tests if NavigableRole is a ListRole.
* @return 'true' if this is a ListRole, otherwise 'false'
*/
syn boolean NavigableRole.isListRole() = false;
eq ListRole.isListRole() = true;
/** Tests if NavigableRole is a OptRole.
* @return 'true' if this is a OptRole, otherwise 'false'
*/
syn boolean NavigableRole.isOptRole() = false;
eq OptRole.isOptRole() = true;
/** Tests if Component is a TypeComponent.
* @return 'true' if this is a TypeComponent, otherwise 'false'
*/
syn boolean Component.isTypeComponent() = false;
eq TypeComponent.isTypeComponent() = true;
/** Tests if Component is a TokenComponent.
* @return 'true' if this is a TokenComponent, otherwise 'false'
*/
syn boolean Component.isTokenComponent() = false;
eq TokenComponent.isTokenComponent() = true;
/** Tests if JavaTypeUse is a SimpleJavaTypeUse.
* @return 'true' if this is a SimpleJavaTypeUse, otherwise 'false'
*/
syn boolean JavaTypeUse.isSimpleJavaTypeUse() = false;
eq SimpleJavaTypeUse.isSimpleJavaTypeUse() = true;
/** Tests if JavaTypeUse is a ParameterizedJavaTypeUse.
* @return 'true' if this is a ParameterizedJavaTypeUse, otherwise 'false'
*/
syn boolean JavaTypeUse.isParameterizedJavaTypeUse() = false;
eq ParameterizedJavaTypeUse.isParameterizedJavaTypeUse() = true;
/** Tests if Relation is a DirectedRelation.
* @return 'true' if this is a DirectedRelation, otherwise 'false'
*/
syn boolean Relation.isDirectedRelation() = false;
eq DirectedRelation.isDirectedRelation() = true;
/** Tests if Relation is a BidirectionalRelation.
* @return 'true' if this is a BidirectionalRelation, otherwise 'false'
*/
syn boolean Relation.isBidirectionalRelation() = false;
eq BidirectionalRelation.isBidirectionalRelation() = true;
/** Tests if Role is a NavigableRole.
* @return 'true' if this is a NavigableRole, otherwise 'false'
*/
syn boolean Role.isNavigableRole() = false;
eq NavigableRole.isNavigableRole() = true;
/** Tests if Role is a UnnamedRole.
* @return 'true' if this is a UnnamedRole, otherwise 'false'
*/
syn boolean Role.isUnnamedRole() = false;
eq UnnamedRole.isUnnamedRole() = true;
/** Tests if Declaration is a EmptyDeclaration.
* @return 'true' if this is a EmptyDeclaration, otherwise 'false'
*/
syn boolean Declaration.isEmptyDeclaration() = false;
eq EmptyDeclaration.isEmptyDeclaration() = true;
/** Tests if Declaration is a TypeDecl.
* @return 'true' if this is a TypeDecl, otherwise 'false'
*/
syn boolean Declaration.isTypeDecl() = false;
eq TypeDecl.isTypeDecl() = true;
/** Tests if Declaration is a Relation.
* @return 'true' if this is a Relation, otherwise 'false'
*/
syn boolean Declaration.isRelation() = false;
eq Relation.isRelation() = true;
/** casts a Comment into a WhitespaceComment if possible.
* @return 'this' cast to a WhitespaceComment or 'null'
*/
syn WhitespaceComment Comment.asWhitespaceComment();
eq Comment.asWhitespaceComment() = null;
eq WhitespaceComment.asWhitespaceComment() = this;
/** casts a Comment into a SingleLineComment if possible.
* @return 'this' cast to a SingleLineComment or 'null'
*/
syn SingleLineComment Comment.asSingleLineComment();
eq Comment.asSingleLineComment() = null;
eq SingleLineComment.asSingleLineComment() = this;
/** casts a Comment into a MultiLineComment if possible.
* @return 'this' cast to a MultiLineComment or 'null'
*/
syn MultiLineComment Comment.asMultiLineComment();
eq Comment.asMultiLineComment() = null;
eq MultiLineComment.asMultiLineComment() = this;
/** casts a Comment into a DocComment if possible.
* @return 'this' cast to a DocComment or 'null'
*/
syn DocComment Comment.asDocComment();
eq Comment.asDocComment() = null;
eq DocComment.asDocComment() = this;
/** casts a DirectedRelation into a LeftDirectedRelation if possible.
* @return 'this' cast to a LeftDirectedRelation or 'null'
*/
syn LeftDirectedRelation DirectedRelation.asLeftDirectedRelation();
eq DirectedRelation.asLeftDirectedRelation() = null;
eq LeftDirectedRelation.asLeftDirectedRelation() = this;
/** casts a DirectedRelation into a RightDirectedRelation if possible.
* @return 'this' cast to a RightDirectedRelation or 'null'
*/
syn RightDirectedRelation DirectedRelation.asRightDirectedRelation();
eq DirectedRelation.asRightDirectedRelation() = null;
eq RightDirectedRelation.asRightDirectedRelation() = this;
/** casts a TypeComponent into a NormalComponent if possible.
* @return 'this' cast to a NormalComponent or 'null'
*/
syn NormalComponent TypeComponent.asNormalComponent();
eq TypeComponent.asNormalComponent() = null;
eq NormalComponent.asNormalComponent() = this;
/** casts a TypeComponent into a ListComponent if possible.
* @return 'this' cast to a ListComponent or 'null'
*/
syn ListComponent TypeComponent.asListComponent();
eq TypeComponent.asListComponent() = null;
eq ListComponent.asListComponent() = this;
/** casts a TypeComponent into a OptComponent if possible.
* @return 'this' cast to a OptComponent or 'null'
*/
syn OptComponent TypeComponent.asOptComponent();
eq TypeComponent.asOptComponent() = null;
eq OptComponent.asOptComponent() = this;
/** casts a Grammar into a GrammarFile if possible.
* @return 'this' cast to a GrammarFile or 'null'
*/
syn GrammarFile Grammar.asGrammarFile();
eq Grammar.asGrammarFile() = null;
eq GrammarFile.asGrammarFile() = this;
/** casts a NavigableRole into a NormalRole if possible.
* @return 'this' cast to a NormalRole or 'null'
*/
syn NormalRole NavigableRole.asNormalRole();
eq NavigableRole.asNormalRole() = null;
eq NormalRole.asNormalRole() = this;
/** casts a NavigableRole into a ListRole if possible.
* @return 'this' cast to a ListRole or 'null'
*/
syn ListRole NavigableRole.asListRole();
eq NavigableRole.asListRole() = null;
eq ListRole.asListRole() = this;
/** casts a NavigableRole into a OptRole if possible.
* @return 'this' cast to a OptRole or 'null'
*/
syn OptRole NavigableRole.asOptRole();
eq NavigableRole.asOptRole() = null;
eq OptRole.asOptRole() = this;
/** casts a Component into a TypeComponent if possible.
* @return 'this' cast to a TypeComponent or 'null'
*/
syn TypeComponent Component.asTypeComponent();
eq Component.asTypeComponent() = null;
eq TypeComponent.asTypeComponent() = this;
/** casts a Component into a TokenComponent if possible.
* @return 'this' cast to a TokenComponent or 'null'
*/
syn TokenComponent Component.asTokenComponent();
eq Component.asTokenComponent() = null;
eq TokenComponent.asTokenComponent() = this;
/** casts a JavaTypeUse into a SimpleJavaTypeUse if possible.
* @return 'this' cast to a SimpleJavaTypeUse or 'null'
*/
syn SimpleJavaTypeUse JavaTypeUse.asSimpleJavaTypeUse();
eq JavaTypeUse.asSimpleJavaTypeUse() = null;
eq SimpleJavaTypeUse.asSimpleJavaTypeUse() = this;
/** casts a JavaTypeUse into a ParameterizedJavaTypeUse if possible.
* @return 'this' cast to a ParameterizedJavaTypeUse or 'null'
*/
syn ParameterizedJavaTypeUse JavaTypeUse.asParameterizedJavaTypeUse();
eq JavaTypeUse.asParameterizedJavaTypeUse() = null;
eq ParameterizedJavaTypeUse.asParameterizedJavaTypeUse() = this;
/** casts a Relation into a DirectedRelation if possible.
* @return 'this' cast to a DirectedRelation or 'null'
*/
syn DirectedRelation Relation.asDirectedRelation();
eq Relation.asDirectedRelation() = null;
eq DirectedRelation.asDirectedRelation() = this;
/** casts a Relation into a BidirectionalRelation if possible.
* @return 'this' cast to a BidirectionalRelation or 'null'
*/
syn BidirectionalRelation Relation.asBidirectionalRelation();
eq Relation.asBidirectionalRelation() = null;
eq BidirectionalRelation.asBidirectionalRelation() = this;
/** casts a Role into a NavigableRole if possible.
* @return 'this' cast to a NavigableRole or 'null'
*/
syn NavigableRole Role.asNavigableRole();
eq Role.asNavigableRole() = null;
eq NavigableRole.asNavigableRole() = this;
/** casts a Role into a UnnamedRole if possible.
* @return 'this' cast to a UnnamedRole or 'null'
*/
syn UnnamedRole Role.asUnnamedRole();
eq Role.asUnnamedRole() = null;
eq UnnamedRole.asUnnamedRole() = this;
/** casts a Declaration into a EmptyDeclaration if possible.
* @return 'this' cast to a EmptyDeclaration or 'null'
*/
syn EmptyDeclaration Declaration.asEmptyDeclaration();
eq Declaration.asEmptyDeclaration() = null;
eq EmptyDeclaration.asEmptyDeclaration() = this;
/** casts a Declaration into a TypeDecl if possible.
* @return 'this' cast to a TypeDecl or 'null'
*/
syn TypeDecl Declaration.asTypeDecl();
eq Declaration.asTypeDecl() = null;
eq TypeDecl.asTypeDecl() = this;
/** casts a Declaration into a Relation if possible.
* @return 'this' cast to a Relation or 'null'
*/
syn Relation Declaration.asRelation();
eq Declaration.asRelation() = null;
eq Relation.asRelation() = this;
}
......@@ -2,6 +2,8 @@ aspect Navigation {
// --- program ---
inh Program ASTNode.program();
eq Grammar.getChild().program() = null;
eq GrammarFile.getChild().program() = program();
eq Program.getChild().program() = this;
// --- typeDecls ---
......@@ -28,66 +30,10 @@ aspect Navigation {
// --- containedFile ---
inh GrammarFile ASTNode.containedFile();
eq Grammar.getChild().containedFile() = null;
eq Program.getChild().containedFile() = null;
eq GrammarFile.getChild().containedFile() = this;
// --- containedFileName ---
inh String ASTNode.containedFileName();
eq GrammarFile.getChild().containedFileName() = getFileName();
// --- isTokenComponent ---
syn boolean Component.isTokenComponent() = false;
eq TokenComponent.isTokenComponent() = true;
// --- asTokenComponent ---
syn TokenComponent Component.asTokenComponent() = null;
eq TokenComponent.asTokenComponent() = this;
// --- isTypeDecl (should be in preprocessor) ---
syn boolean Declaration.isTypeDecl() = false;
eq TypeDecl.isTypeDecl() = true;
// --- asTypeDecl (should be in preprocessor) ---
syn TypeDecl Declaration.asTypeDecl() = null;
eq TypeDecl.asTypeDecl() = this;
// --- isTypeComponent (should be in preprocessor) ---
syn boolean Component.isTypeComponent() = false;
eq TypeComponent.isTypeComponent() = true;
// --- asTypeComponent (should be in preprocessor) ---
syn TypeComponent Component.asTypeComponent() = null;
eq TypeComponent.asTypeComponent() = this;
// --- isNormalComponent (should be in preprocessor) ---
syn boolean Component.isNormalComponent() = false;
eq NormalComponent.isNormalComponent() = true;
// --- asNormalComponent (should be in preprocessor) ---
syn NormalComponent Component.asNormalComponent() = null;
eq NormalComponent.asNormalComponent() = this;
// --- isListComponent (should be in preprocessor) ---
syn boolean Component.isListComponent() = false;
eq ListComponent.isListComponent() = true;
// --- asListComponent (should be in preprocessor) ---
syn ListComponent Component.asListComponent() = null;
eq ListComponent.asListComponent() = this;
// --- isDirectedRelation (should be in preprocessor) ---
syn boolean Relation.isDirectedRelation() = false;
eq DirectedRelation.isDirectedRelation() = true;
// --- asDirectedRelation (should be in preprocessor) ---
syn DirectedRelation Relation.asDirectedRelation() = null;
eq DirectedRelation.asDirectedRelation() = this;
// --- asBidirectionalRelation (should be in preprocessor) ---
syn BidirectionalRelation Relation.asBidirectionalRelation() = null;
eq BidirectionalRelation.asBidirectionalRelation() = this;
// --- isListRole (should be in preprocessor) ---
syn boolean Role.isListRole() = false;
eq ListRole.isListRole() = true;
syn String ASTNode.containedFileName() = containedFile().getFileName();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment