Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relational-rags
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
relational-rags
Commits
abce5ee8
Commit
abce5ee8
authored
6 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
Add option for JastAddList name.
parent
dcfe383c
No related branches found
No related tags found
1 merge request
!1
Mquat2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
spec/jastadd/Backend.jadd
+2
-1
2 additions, 1 deletion
spec/jastadd/Backend.jadd
src/java/org/jastadd/relast/compiler/Compiler.java
+20
-9
20 additions, 9 deletions
src/java/org/jastadd/relast/compiler/Compiler.java
with
22 additions
and
10 deletions
spec/jastadd/Backend.jadd
+
2
−
1
View file @
abce5ee8
aspect BackendAbstractGrammar {
aspect BackendAbstractGrammar {
public static String ASTNode.listClass = "ArrayList";
public static String ASTNode.listClass = "ArrayList";
public static String ASTNode.jastAddListType = "List";
public String Program.generateAbstractGrammar() {
public String Program.generateAbstractGrammar() {
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder();
...
@@ -120,7 +121,7 @@ aspect BackendAspect {
...
@@ -120,7 +121,7 @@ aspect BackendAspect {
return getTypeUse() + " " + getID();
return getTypeUse() + " " + getID();
}
}
public String ListComponent.constructorParameter() {
public String ListComponent.constructorParameter() {
return
"List
<" + getTypeUse() + "> " + getID();
return
ASTNode.jastAddListType + "
<" + getTypeUse() + "> " + getID();
}
}
public String OptComponent.constructorParameter() {
public String OptComponent.constructorParameter() {
return "Opt<" + getTypeUse() + "> " + getID();
return "Opt<" + getTypeUse() + "> " + getID();
...
...
This diff is collapsed.
Click to expand it.
src/java/org/jastadd/relast/compiler/Compiler.java
+
20
−
9
View file @
abce5ee8
...
@@ -18,11 +18,12 @@ import org.jastadd.relast.compiler.options.CommandLine.CommandLineException;
...
@@ -18,11 +18,12 @@ import org.jastadd.relast.compiler.options.CommandLine.CommandLineException;
import
beaver.Parser
;
import
beaver.Parser
;
public
class
Compiler
{
public
class
Compiler
{
protected
ArrayList
<
Option
<?>>
options
;
private
ArrayList
<
Option
<?>>
options
;
protected
FlagOption
optionWriteToFile
;
private
FlagOption
optionWriteToFile
;
protected
FlagOption
optionPrintAST
;
private
FlagOption
optionPrintAST
;
protected
StringOption
optionListClass
;
private
StringOption
optionListClass
;
protected
CommandLine
commandLine
;
private
StringOption
optionJastAddList
;
private
CommandLine
commandLine
;
public
Compiler
(
String
args
[])
throws
CommandLineException
{
public
Compiler
(
String
args
[])
throws
CommandLineException
{
options
=
new
ArrayList
<>();
options
=
new
ArrayList
<>();
...
@@ -51,9 +52,14 @@ public class Compiler {
...
@@ -51,9 +52,14 @@ public class Compiler {
if
(
optionListClass
.
isSet
())
{
if
(
optionListClass
.
isSet
())
{
System
.
out
.
println
(
"ListClass is set to "
+
optionListClass
.
getValue
());
System
.
out
.
println
(
"ListClass is set to "
+
optionListClass
.
getValue
());
p
.
listClass
=
optionListClass
.
getValue
();
ASTNode
.
listClass
=
optionListClass
.
getValue
();
}
}
if
(
optionJastAddList
.
isSet
())
{
System
.
out
.
println
(
"JastAdd List type is set to "
+
optionJastAddList
.
getValue
());
ASTNode
.
jastAddListType
=
optionJastAddList
.
getValue
();
}
if
(
optionWriteToFile
.
isSet
())
{
if
(
optionWriteToFile
.
isSet
())
{
File
file
=
new
File
(
filename
);
File
file
=
new
File
(
filename
);
String
absPath
=
file
.
getAbsolutePath
();
String
absPath
=
file
.
getAbsolutePath
();
...
@@ -81,9 +87,14 @@ public class Compiler {
...
@@ -81,9 +87,14 @@ public class Compiler {
}
}
protected
void
addOptions
()
{
protected
void
addOptions
()
{
optionWriteToFile
=
addOption
(
new
FlagOption
(
"file"
,
"write output to files <filename>Gen.ast and <filename>Gen.jadd"
));
optionWriteToFile
=
addOption
(
new
FlagOption
(
"file"
,
optionPrintAST
=
addOption
(
new
FlagOption
(
"ast"
,
"print AST"
));
"write output to files <filename>Gen.ast and <filename>Gen.jadd"
));
optionListClass
=
addOption
(
new
StringOption
(
"listClass"
,
"determine the class name of the nonterminal reference list"
));
optionPrintAST
=
addOption
(
new
FlagOption
(
"ast"
,
"print AST"
));
optionListClass
=
addOption
(
new
StringOption
(
"listClass"
,
"determine the class name of the nonterminal reference list"
));
optionJastAddList
=
addOption
(
new
StringOption
(
"jastAddList"
,
"set the name of the List type in JastAdd (has to match the option '--List' or its default List)"
));
}
}
protected
<
OptionType
extends
Option
<?>>
OptionType
addOption
(
OptionType
option
)
{
protected
<
OptionType
extends
Option
<?>>
OptionType
addOption
(
OptionType
option
)
{
...
...
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