From 36da0daad75ac3e1bf572840d6ffa353abc88841 Mon Sep 17 00:00:00 2001 From: Terence Parr Date: Thu, 5 Jun 2014 19:22:09 -0700 Subject: [PATCH] no longer passing Parser/Lexer masquerading as superClass option. --- .../v4/tool/templates/codegen/Java/Java.stg | 7 ++-- .../src/org/antlr/v4/codegen/model/Lexer.java | 5 --- .../org/antlr/v4/codegen/model/Parser.java | 5 --- .../model/chunk/DefaultLexerSuperClass.java | 35 ------------------- .../model/chunk/DefaultParserSuperClass.java | 35 ------------------- 5 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 tool/src/org/antlr/v4/codegen/model/chunk/DefaultLexerSuperClass.java delete mode 100644 tool/src/org/antlr/v4/codegen/model/chunk/DefaultParserSuperClass.java diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg index edd53bd3d..f328c0087 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg @@ -213,7 +213,7 @@ Parser(parser, funcs, atn, sempredFuncs, superClass) ::= << Parser_(parser, funcs, atn, sempredFuncs, ctor, superClass) ::= << @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) -public class extends { +public class extends Parser { static { RuntimeMetaData.checkVersion("", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; @@ -623,9 +623,6 @@ LexerChannelCommand(arg) ::= "_channel = ;" LexerModeCommand(arg) ::= "_mode = ;" LexerPushModeCommand(arg) ::= "pushMode();" -DefaultParserSuperClass(s) ::= "Parser" -DefaultLexerSuperClass(s) ::= "Lexer" - ActionText(t) ::= "" ActionTemplate(t) ::= "" ArgRef(a) ::= "_localctx." @@ -815,7 +812,7 @@ import org.antlr.v4.runtime.misc.*; Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass) ::= << @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) -public class extends { +public class extends Lexer { static { RuntimeMetaData.checkVersion("", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; diff --git a/tool/src/org/antlr/v4/codegen/model/Lexer.java b/tool/src/org/antlr/v4/codegen/model/Lexer.java index f534cf384..bf4a97a5c 100644 --- a/tool/src/org/antlr/v4/codegen/model/Lexer.java +++ b/tool/src/org/antlr/v4/codegen/model/Lexer.java @@ -34,7 +34,6 @@ import org.antlr.v4.codegen.CodeGenerator; import org.antlr.v4.codegen.OutputModelFactory; import org.antlr.v4.codegen.model.chunk.ActionChunk; import org.antlr.v4.codegen.model.chunk.ActionText; -import org.antlr.v4.codegen.model.chunk.DefaultLexerSuperClass; import org.antlr.v4.tool.Grammar; import org.antlr.v4.tool.LexerGrammar; import org.antlr.v4.tool.Rule; @@ -98,9 +97,5 @@ public class Lexer extends OutputModelObject { if (g.getOptionString("superClass") != null) { superClass = new ActionText(null, g.getOptionString("superClass")); } - else { - superClass = new DefaultLexerSuperClass(); - } } - } diff --git a/tool/src/org/antlr/v4/codegen/model/Parser.java b/tool/src/org/antlr/v4/codegen/model/Parser.java index 839ceaca5..da7fde5d2 100644 --- a/tool/src/org/antlr/v4/codegen/model/Parser.java +++ b/tool/src/org/antlr/v4/codegen/model/Parser.java @@ -34,7 +34,6 @@ import org.antlr.v4.codegen.CodeGenerator; import org.antlr.v4.codegen.OutputModelFactory; import org.antlr.v4.codegen.model.chunk.ActionChunk; import org.antlr.v4.codegen.model.chunk.ActionText; -import org.antlr.v4.codegen.model.chunk.DefaultParserSuperClass; import org.antlr.v4.tool.Grammar; import org.antlr.v4.tool.Rule; @@ -46,7 +45,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -/** */ public class Parser extends OutputModelObject { public String name; public String grammarFileName; @@ -97,8 +95,5 @@ public class Parser extends OutputModelObject { if (g.getOptionString("superClass") != null) { superClass = new ActionText(null, g.getOptionString("superClass")); } - else { - superClass = new DefaultParserSuperClass(); - } } } diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/DefaultLexerSuperClass.java b/tool/src/org/antlr/v4/codegen/model/chunk/DefaultLexerSuperClass.java deleted file mode 100644 index ab5497a37..000000000 --- a/tool/src/org/antlr/v4/codegen/model/chunk/DefaultLexerSuperClass.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * [The "BSD license"] - * Copyright (c) 2012 Terence Parr - * Copyright (c) 2012 Sam Harwell - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.antlr.v4.codegen.model.chunk; - -public class DefaultLexerSuperClass extends ActionChunk { - public DefaultLexerSuperClass() { super(null); } -} diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/DefaultParserSuperClass.java b/tool/src/org/antlr/v4/codegen/model/chunk/DefaultParserSuperClass.java deleted file mode 100644 index 0b7fa4e52..000000000 --- a/tool/src/org/antlr/v4/codegen/model/chunk/DefaultParserSuperClass.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * [The "BSD license"] - * Copyright (c) 2012 Terence Parr - * Copyright (c) 2012 Sam Harwell - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.antlr.v4.codegen.model.chunk; - -public class DefaultParserSuperClass extends ActionChunk { - public DefaultParserSuperClass() { super(null); } -}