diff --git a/ChangeLog b/ChangeLog index a46dac5bf20feb3836ff7715a62b9d31ed409aca..d3f30aa4899dfeb946c435967b3615b2b1944908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +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> * Fixed faulty code generation for incremental attributes with NTA tokens. @@ -505,7 +509,7 @@ 2013-12-03 Niklas Fors <niklas.fors@cs.lth.se> - * Added the abstract methods fullCopy(), treeCopyNoTransform() and + * Added the abstract methods fullCopy(), treeCopyNoTransform() and treeCopy() to abstract classes (with correct return type). 2013-10-30 Jesper Öqvist <jesper.oqvist@cs.lth.se> @@ -1358,7 +1362,8 @@ Removed errornous rewrite initialization code generated with rewrites disabled ---------------------------- jastadd2.jar revision 1.13 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 date: 2004-10-13 20:07:20 +0200; author: torbjorn; state: Exp; lines: +417 -424; diff --git a/src/java/org/jastadd/Configuration.java b/src/java/org/jastadd/Configuration.java index 5e304be489703c740bac1b8b5ba53b67a295bdbe..a28316191149f26feb2188bfb54ac5aa5df8f0c6 100644 --- a/src/java/org/jastadd/Configuration.java +++ b/src/java/org/jastadd/Configuration.java @@ -121,11 +121,11 @@ public class Configuration { .templateVariable("generateAnnotations"); Option<Boolean> jjtreeOption = new FlagOption("jjtree", - "use jjtree base node, this requires --grammar to be set") + "use jjtree base node") .templateVariable("JJTree"); 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"); Option<String> defaultMapOption = new ValueOption( @@ -191,7 +191,7 @@ public class Configuration { // TODO(jesper): make this deprecated. Option<Boolean> inhEqCheckOption = new BooleanOption("inhEqCheck", - "enalbe check for inherited equations") + "enable check for inherited equations") .defaultValue(true) .nonStandard(); @@ -634,11 +634,6 @@ public class Configuration { 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>(); for (String filename: filenames) { if (filename.endsWith(".ast")) { @@ -1282,7 +1277,7 @@ public class Configuration { * @return {@code true} annotations shall be generated. */ public boolean generateAnnotations() { - return generateAnnotations.value(); + return generateAnnotations.value(); } /** diff --git a/src/template/ast/JJTree.tt b/src/template/ast/JJTree.tt index fb4bb9d02b6caa860cbdc8733f155aa5c337a09e..c7bb2c99027823512fed6da67dec322d1a0e3992 100644 --- a/src/template/ast/JJTree.tt +++ b/src/template/ast/JJTree.tt @@ -49,9 +49,11 @@ JJTree.dumpTree = [[ ]] JJTree.jjtAccept = [[ +$if(ParserName) public Object #name.jjtAccept($(ParserName)Visitor visitor, Object data) { return visitor.visit(this, data); } +$endif ]] JJTree.checkChild = [[ diff --git a/src/template/ast/NodeConstructor.tt b/src/template/ast/NodeConstructor.tt index 33c73eb5a19090b143fd74800f5d89ba0203acce..4b0db9e1de76377aa0652f7e00192244b70bc470 100644 --- a/src/template/ast/NodeConstructor.tt +++ b/src/template/ast/NodeConstructor.tt @@ -35,10 +35,12 @@ $endif $FinalInit } +$if(ParserName) public #name.#name($ParserName p, int i) { this(i); parser = p; } +$endif public #name.#name() { this(0);