Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anders Nilsson
OwlCompiler
Commits
683281f4
Commit
683281f4
authored
Apr 04, 2007
by
Anders Nilsson
Browse files
Synching
parent
85eb9240
Changes
1
Hide whitespace changes
Inline
Side-by-side
siaras/SkillserverInterface.jrag
View file @
683281f4
...
...
@@ -33,18 +33,64 @@ aspect Misc {
public String Thing.id() {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i).isIdentifier()) {
Identifier ident = ((ClassUse) getElement(i)).decl();
return ident.getElement(0)
.id
();
Identifier ident =
(Identifier)
((ClassUse) getElement(i)).decl();
return
((StringElement)
ident.getElement(0)
).getLITERAL
();
}
}
return null;
}
public String ValueElement.id() {
return getElement(0).getLITERAL();
}
syn boolean Element.isIdentifier() = false;
eq Identifier.isIdentifier() = true;
eq ClassUse.isIdentifier() = decl().isIdentifier();
}
aspect Decl {
syn lazy Thing ClassUse.decl() {
String id = getAttribute(0).getValue().getSTRING_LITERAL();
return rootNode().findDecl(id);
}
Start ASTNode.rootNode() {
ASTNode parent = getParent();
while (!(parent instanceof Start)) {
parent = parent.getParent();
}
return (Start) parent;
}
syn Thing Start.findDecl(String id) {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i).findDecl(id) != null) {
return (Thing) getElement(i);
}
}
return null;
}
syn Thing Element.findDecl(String id) = null;
eq ComplexElement.findDecl(String id) {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i).findDecl(id) != null) {
return (Thing) getElement(i);
}
}
return null;
}
eq Thing.findDecl(String id) {
for (int i=0; i<getNumAttribute(); i++) {
if (getAttribute(i).isEqualId(id)) {
return this;
}
}
return null;
}
syn boolean Attribute.isEqualId(String id) = false;
eq RdfId.isEqualId(String id) {
if (getValue().getSTRING_LITERAL().equals(id)) {
return true;
}
return false;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment