rm abstract option

This commit is contained in:
Terence Parr 2012-09-07 17:01:16 -07:00
parent 5403d9bae9
commit dfeca1b9d9
5 changed files with 2 additions and 21 deletions

View File

@ -88,7 +88,7 @@ Parser(parser, funcs, atn, sempredFuncs, superClass) ::= <<
Parser_(parser, funcs, atn, sempredFuncs, ctor, extras, superClass) ::= <<
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public <if(parser.abstractRecognizer)>abstract <endif>class <parser.name> extends <superClass> {
public class <parser.name> extends <superClass> {
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
@ -681,7 +681,7 @@ import org.antlr.v4.runtime.misc.*;
Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass) ::= <<
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public <if(lexer.abstractRecognizer)>abstract <endif>class <lexer.name> extends <superClass> {
public class <lexer.name> extends <superClass> {
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();

View File

@ -52,7 +52,6 @@ public class Lexer extends OutputModelObject {
public String[] tokenNames;
public Set<String> ruleNames;
public Collection<String> modes;
public boolean abstractRecognizer;
@ModelElement public ActionChunk superClass;
@ModelElement public SerializedATN atn;
@ -101,8 +100,6 @@ public class Lexer extends OutputModelObject {
else {
superClass = new DefaultLexerSuperClass();
}
abstractRecognizer = g.isAbstract();
}
}

View File

@ -56,7 +56,6 @@ public class Parser extends OutputModelObject {
public Set<String> ruleNames;
public Collection<Rule> rules;
public ParserFile file;
public boolean abstractRecognizer;
@ModelElement public List<RuleFunction> funcs = new ArrayList<RuleFunction>();
@ModelElement public SerializedATN atn;
@ -100,7 +99,5 @@ public class Parser extends OutputModelObject {
else {
superClass = new DefaultParserSuperClass();
}
abstractRecognizer = g.isAbstract();
}
}

View File

@ -73,7 +73,6 @@ public class Grammar implements AttributeResolver {
public static final Set<String> parserOptions = new HashSet<String>() {{
add("superClass");
add("TokenLabelType");
add("abstract");
add("tokenVocab");
add("language");
}};
@ -103,7 +102,6 @@ public class Grammar implements AttributeResolver {
new HashSet() {{
add("superClass");
add("TokenLabelType");
add("abstract");
add("tokenVocab");
}};
@ -401,10 +399,6 @@ public class Grammar implements AttributeResolver {
return parent.getOutermostGrammar();
}
public boolean isAbstract() {
return Boolean.parseBoolean(getOptionString("abstract"));
}
/** Get the name of the generated recognizer; may or may not be same
* as grammar name.
* Recognizer is TParser and TLexer from T if combined, else
@ -420,15 +414,9 @@ public class Grammar implements AttributeResolver {
buf.append(g.name);
buf.append('_');
}
if (isAbstract()) {
buf.append("Abstract");
}
buf.append(name);
qualifiedName = buf.toString();
}
else if (isAbstract()) {
qualifiedName = "Abstract" + name;
}
if ( isCombined() || (isLexer() && implicitLexer!=null) )
{

View File

@ -40,7 +40,6 @@ public class GrammarRootAST extends GrammarASTWithOptions {
public static final Map<String, String> defaultOptions =
new HashMap<String, String>() {{
put("language","Java");
put("abstract","false");
}};
public int grammarType; // LEXER, PARSER, GRAMMAR (combined)
public boolean hasErrors;