Skip to content
Snippets Groups Projects
Commit 1a525825 authored by Niklas Fors's avatar Niklas Fors
Browse files

Make --gammar optional when using --jjtree

parent 585acc19
Branches
No related tags found
No related merge requests found
2019-11-15 Niklas Fors <niklas.fors@cs.lth.se>
* Made --gammar optional when using --jjtree
2019-11-15 Jesper Öqvist <jesper.oqvist@cs.lth.se> 2019-11-15 Jesper Öqvist <jesper.oqvist@cs.lth.se>
* Fixed faulty code generation for incremental attributes with NTA tokens. * Fixed faulty code generation for incremental attributes with NTA tokens.
...@@ -1358,7 +1362,8 @@ Removed errornous rewrite initialization code generated with rewrites disabled ...@@ -1358,7 +1362,8 @@ Removed errornous rewrite initialization code generated with rewrites disabled
---------------------------- ----------------------------
jastadd2.jar revision 1.13 jastadd2.jar revision 1.13
date: 2004-10-19 11:31:41 +0200; author: mjolner; state: Exp; lines: +636 -627; date: 2004-10-19 11:31:41 +0200; author: mjolner; state: Exp; lines: +636 -627;
Handle primitive circular attributes. Handle inherited circular attributes. Handle primitive circular attributes.
Handle inherited circular attributes.
---------------------------- ----------------------------
jastadd2.jar revision 1.12 jastadd2.jar revision 1.12
date: 2004-10-13 20:07:20 +0200; author: torbjorn; state: Exp; lines: +417 -424; date: 2004-10-13 20:07:20 +0200; author: torbjorn; state: Exp; lines: +417 -424;
......
...@@ -121,11 +121,11 @@ public class Configuration { ...@@ -121,11 +121,11 @@ public class Configuration {
.templateVariable("generateAnnotations"); .templateVariable("generateAnnotations");
Option<Boolean> jjtreeOption = new FlagOption("jjtree", Option<Boolean> jjtreeOption = new FlagOption("jjtree",
"use jjtree base node, this requires --grammar to be set") "use jjtree base node")
.templateVariable("JJTree"); .templateVariable("JJTree");
Option<String> grammarOption = new ValueOption("grammar", Option<String> grammarOption = new ValueOption("grammar",
"the name of the grammar's parser, required when using --jjtree") "parser name when using --jjtree, used for generating visitor methods")
.templateVariable("ParserName"); .templateVariable("ParserName");
Option<String> defaultMapOption = new ValueOption( Option<String> defaultMapOption = new ValueOption(
...@@ -191,7 +191,7 @@ public class Configuration { ...@@ -191,7 +191,7 @@ public class Configuration {
// TODO(jesper): make this deprecated. // TODO(jesper): make this deprecated.
Option<Boolean> inhEqCheckOption = new BooleanOption("inhEqCheck", Option<Boolean> inhEqCheckOption = new BooleanOption("inhEqCheck",
"enalbe check for inherited equations") "enable check for inherited equations")
.defaultValue(true) .defaultValue(true)
.nonStandard(); .nonStandard();
...@@ -634,11 +634,6 @@ public class Configuration { ...@@ -634,11 +634,6 @@ public class Configuration {
return true; return true;
} }
if (jjtreeOption.value() && grammarOption.value().isEmpty()) {
out.println("Error: No grammar name given. A grammar name is required in JJTree-mode!");
return true;
}
Collection<String> grammarFiles = new LinkedList<String>(); Collection<String> grammarFiles = new LinkedList<String>();
for (String filename: filenames) { for (String filename: filenames) {
if (filename.endsWith(".ast")) { if (filename.endsWith(".ast")) {
......
...@@ -49,9 +49,11 @@ JJTree.dumpTree = [[ ...@@ -49,9 +49,11 @@ JJTree.dumpTree = [[
]] ]]
JJTree.jjtAccept = [[ JJTree.jjtAccept = [[
$if(ParserName)
public Object #name.jjtAccept($(ParserName)Visitor visitor, Object data) { public Object #name.jjtAccept($(ParserName)Visitor visitor, Object data) {
return visitor.visit(this, data); return visitor.visit(this, data);
} }
$endif
]] ]]
JJTree.checkChild = [[ JJTree.checkChild = [[
......
...@@ -35,10 +35,12 @@ $endif ...@@ -35,10 +35,12 @@ $endif
$FinalInit $FinalInit
} }
$if(ParserName)
public #name.#name($ParserName p, int i) { public #name.#name($ParserName p, int i) {
this(i); this(i);
parser = p; parser = p;
} }
$endif
public #name.#name() { public #name.#name() {
this(0); this(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment