forked from jasder/antlr
repl space with tabs.
This commit is contained in:
parent
4acb1091de
commit
8937e0d16e
|
@ -89,26 +89,26 @@ public abstract class Target {
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ANTLR tool should check output templates / target are compatible with tool code generation.
|
/** ANTLR tool should check output templates / target are compatible with tool code generation.
|
||||||
* For now, a simple string match used on x.y of x.y.z scheme. We use a method to avoid mismatches
|
* For now, a simple string match used on x.y of x.y.z scheme. We use a method to avoid mismatches
|
||||||
* between a template called VERSION. This value is checked against Tool.VERSION during load of templates.
|
* between a template called VERSION. This value is checked against Tool.VERSION during load of templates.
|
||||||
*
|
*
|
||||||
* This additional method forces all targets 4.3 and beyond to add this method.
|
* This additional method forces all targets 4.3 and beyond to add this method.
|
||||||
*
|
*
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
*/
|
*/
|
||||||
public abstract String getVersion();
|
public abstract String getVersion();
|
||||||
|
|
||||||
public STGroup getTemplates() {
|
public STGroup getTemplates() {
|
||||||
if (templates == null) {
|
if (templates == null) {
|
||||||
String version = getVersion();
|
String version = getVersion();
|
||||||
if ( version==null ||
|
if ( version==null ||
|
||||||
!RuntimeMetaData.getMajorMinorVersion(version).equals(RuntimeMetaData.getMajorMinorVersion(Tool.VERSION)))
|
!RuntimeMetaData.getMajorMinorVersion(version).equals(RuntimeMetaData.getMajorMinorVersion(Tool.VERSION)))
|
||||||
{
|
{
|
||||||
gen.tool.errMgr.toolError(ErrorType.INCOMPATIBLE_TOOL_AND_TEMPLATES, version, Tool.VERSION, language);
|
gen.tool.errMgr.toolError(ErrorType.INCOMPATIBLE_TOOL_AND_TEMPLATES, version, Tool.VERSION, language);
|
||||||
}
|
}
|
||||||
templates = loadTemplates();
|
templates = loadTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
@ -314,33 +314,33 @@ public abstract class Target {
|
||||||
|
|
||||||
public boolean grammarSymbolCausesIssueInGeneratedCode(GrammarAST idNode) {
|
public boolean grammarSymbolCausesIssueInGeneratedCode(GrammarAST idNode) {
|
||||||
switch (idNode.getParent().getType()) {
|
switch (idNode.getParent().getType()) {
|
||||||
case ANTLRParser.ASSIGN:
|
case ANTLRParser.ASSIGN:
|
||||||
switch (idNode.getParent().getParent().getType()) {
|
switch (idNode.getParent().getParent().getType()) {
|
||||||
|
case ANTLRParser.ELEMENT_OPTIONS:
|
||||||
|
case ANTLRParser.OPTIONS:
|
||||||
|
return false;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ANTLRParser.AT:
|
||||||
case ANTLRParser.ELEMENT_OPTIONS:
|
case ANTLRParser.ELEMENT_OPTIONS:
|
||||||
case ANTLRParser.OPTIONS:
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
case ANTLRParser.LEXER_ACTION_CALL:
|
||||||
|
if (idNode.getChildIndex() == 0) {
|
||||||
|
// first child is the command name which is part of the ANTLR language
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// arguments to the command should be checked
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ANTLRParser.AT:
|
|
||||||
case ANTLRParser.ELEMENT_OPTIONS:
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case ANTLRParser.LEXER_ACTION_CALL:
|
|
||||||
if (idNode.getChildIndex() == 0) {
|
|
||||||
// first child is the command name which is part of the ANTLR language
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// arguments to the command should be checked
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return visibleGrammarSymbolCausesIssueInGeneratedCode(idNode);
|
return visibleGrammarSymbolCausesIssueInGeneratedCode(idNode);
|
||||||
|
|
Loading…
Reference in New Issue