Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relast-preprocessor
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
relast-preprocessor
Commits
79d237fd
Commit
79d237fd
authored
4 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
Add some is/as attributes, fix problems in AbstractCompiler.
parent
2276c320
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/jastadd/Navigation.jrag
+59
-0
59 additions, 0 deletions
src/main/jastadd/Navigation.jrag
src/main/java/org/jastadd/relast/compiler/AbstractCompiler.java
+3
-5
3 additions, 5 deletions
...in/java/org/jastadd/relast/compiler/AbstractCompiler.java
with
62 additions
and
5 deletions
src/main/jastadd/Navigation.jrag
+
59
−
0
View file @
79d237fd
...
@@ -16,14 +16,25 @@ aspect Navigation {
...
@@ -16,14 +16,25 @@ aspect Navigation {
to Program.relations()
to Program.relations()
for program();
for program();
// --- allTokenComponents ---
coll java.util.Set<TokenComponent> Program.allTokenComponents() [new java.util.HashSet<>()] root Program;
TokenComponent contributes this
to Program.allTokenComponents()
for program();
// --- containingTypeDecl ---
// --- containingTypeDecl ---
inh TypeDecl Component.containingTypeDecl();
inh TypeDecl Component.containingTypeDecl();
eq TypeDecl.getChild().containingTypeDecl() = this;
eq TypeDecl.getChild().containingTypeDecl() = this;
// --- containedFile ---
// --- containedFile ---
inh GrammarFile ASTNode.containedFile();
inh GrammarFile ASTNode.containedFile();
eq Program.getChild().containedFile() = null;
eq GrammarFile.getChild().containedFile() = this;
eq GrammarFile.getChild().containedFile() = this;
// --- containedFileName ---
inh String ASTNode.containedFileName();
eq GrammarFile.getChild().containedFileName() = getFileName();
// --- isTokenComponent ---
// --- isTokenComponent ---
syn boolean Component.isTokenComponent() = false;
syn boolean Component.isTokenComponent() = false;
eq TokenComponent.isTokenComponent() = true;
eq TokenComponent.isTokenComponent() = true;
...
@@ -31,4 +42,52 @@ aspect Navigation {
...
@@ -31,4 +42,52 @@ aspect Navigation {
// --- asTokenComponent ---
// --- asTokenComponent ---
syn TokenComponent Component.asTokenComponent() = null;
syn TokenComponent Component.asTokenComponent() = null;
eq TokenComponent.asTokenComponent() = this;
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;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/org/jastadd/relast/compiler/AbstractCompiler.java
+
3
−
5
View file @
79d237fd
package
org.jastadd.relast.compiler
;
package
org.jastadd.relast.compiler
;
import
org.jastadd.JastAddConfiguration
;
import
org.jastadd.JastAddConfiguration
;
import
org.jastadd.option.ArgumentParser
;
import
org.jastadd.option.Option
;
import
org.jastadd.option.Option
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -10,8 +9,7 @@ public abstract class AbstractCompiler {
...
@@ -10,8 +9,7 @@ public abstract class AbstractCompiler {
private
final
boolean
jastAddCompliant
;
private
final
boolean
jastAddCompliant
;
protected
ArrayList
<
Option
<?>>
options
;
protected
ArrayList
<
Option
<?>>
options
;
private
String
name
;
private
final
String
name
;
private
ArgumentParser
commandLine
;
private
JastAddConfiguration
configuration
;
private
JastAddConfiguration
configuration
;
...
@@ -36,7 +34,7 @@ public abstract class AbstractCompiler {
...
@@ -36,7 +34,7 @@ public abstract class AbstractCompiler {
return
compile
();
return
compile
();
}
}
abstract
int
compile
()
throws
CompilerException
;
protected
abstract
int
compile
()
throws
CompilerException
;
protected
void
initOptions
()
{
protected
void
initOptions
()
{
// there are no options by default
// there are no options by default
...
@@ -52,7 +50,7 @@ public abstract class AbstractCompiler {
...
@@ -52,7 +50,7 @@ public abstract class AbstractCompiler {
System
.
err
.
println
();
System
.
err
.
println
();
System
.
err
.
println
(
"Usage: java -jar "
+
name
+
".jar [--option1] [--option2=value] ... <filename1> <filename2> ... "
);
System
.
err
.
println
(
"Usage: java -jar "
+
name
+
".jar [--option1] [--option2=value] ... <filename1> <filename2> ... "
);
System
.
err
.
println
(
"Options:"
);
System
.
err
.
println
(
"Options:"
);
co
mmandLine
.
printHelp
(
System
.
err
);
co
nfiguration
.
printHelp
(
System
.
err
);
return
1
;
return
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment