org.antlr.v4.runtime.tree.ParseTreeVisitor Java Examples

The following examples show how to use org.antlr.v4.runtime.tree.ParseTreeVisitor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParseTreeVisitorFactory.java    From shardingsphere with Apache License 2.0 6 votes vote down vote up
@SneakyThrows
private static ParseTreeVisitor createParseTreeVisitor(final SQLParserConfiguration configuration, final SQLStatementType type) {
    SQLVisitorFacade visitorFacade = configuration.getVisitorFacadeClass().getConstructor().newInstance();
    switch (type) {
        case DML:
            return (ParseTreeVisitor) visitorFacade.getDMLVisitorClass().getConstructor().newInstance();
        case DDL:
            return (ParseTreeVisitor) visitorFacade.getDDLVisitorClass().getConstructor().newInstance();
        case TCL:
            return (ParseTreeVisitor) visitorFacade.getTCLVisitorClass().getConstructor().newInstance();
        case DCL:
            return (ParseTreeVisitor) visitorFacade.getDCLVisitorClass().getConstructor().newInstance();
        case DAL:
            return (ParseTreeVisitor) visitorFacade.getDALVisitorClass().getConstructor().newInstance();
        case RL:
            return (ParseTreeVisitor) visitorFacade.getRLVisitorClass().getConstructor().newInstance();
        default:
            throw new SQLParsingException("Can not support SQL statement type: `%s`", type);
    }
}
 
Example #2
Source File: EditorConfigParser.java    From editorconfig-netbeans with MIT License 5 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
  if (visitor instanceof EditorConfigParserVisitor) {
    return ((EditorConfigParserVisitor<? extends T>) visitor).visitPropertyValue(this);
  } else {
    return visitor.visitChildren(this);
  }
}
 
Example #3
Source File: XGBoostModelParser.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
    if (visitor instanceof XGBoostModelVisitor)
        return ((XGBoostModelVisitor<? extends T>)visitor).visitXgModel(this);
    else
        return visitor.visitChildren(this);
}
 
Example #4
Source File: XGBoostModelParser.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
    if (visitor instanceof XGBoostModelVisitor)
        return ((XGBoostModelVisitor<? extends T>)visitor).visitXgTree(this);
    else
        return visitor.visitChildren(this);
}
 
Example #5
Source File: XGBoostModelParser.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
    if (visitor instanceof XGBoostModelVisitor)
        return ((XGBoostModelVisitor<? extends T>)visitor).visitXgLeaf(this);
    else
        return visitor.visitChildren(this);
}
 
Example #6
Source File: XGBoostModelParser.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
    if (visitor instanceof XGBoostModelVisitor)
        return ((XGBoostModelVisitor<? extends T>)visitor).visitXgNode(this);
    else
        return visitor.visitChildren(this);
}
 
Example #7
Source File: XGBoostModelParser.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
    if (visitor instanceof XGBoostModelVisitor)
        return ((XGBoostModelVisitor<? extends T>)visitor).visitXgHeader(this);
    else
        return visitor.visitChildren(this);
}
 
Example #8
Source File: XGBoostModelParser.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
    if (visitor instanceof XGBoostModelVisitor)
        return ((XGBoostModelVisitor<? extends T>)visitor).visitXgValue(this);
    else
        return visitor.visitChildren(this);
}
 
Example #9
Source File: EditorConfigParser.java    From editorconfig-netbeans with MIT License 5 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
  if (visitor instanceof EditorConfigParserVisitor) {
    return ((EditorConfigParserVisitor<? extends T>) visitor).visitFile(this);
  } else {
    return visitor.visitChildren(this);
  }
}
 
Example #10
Source File: EditorConfigParser.java    From editorconfig-netbeans with MIT License 5 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
  if (visitor instanceof EditorConfigParserVisitor) {
    return ((EditorConfigParserVisitor<? extends T>) visitor).visitSection(this);
  } else {
    return visitor.visitChildren(this);
  }
}
 
Example #11
Source File: EditorConfigParser.java    From editorconfig-netbeans with MIT License 5 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
  if (visitor instanceof EditorConfigParserVisitor) {
    return ((EditorConfigParserVisitor<? extends T>) visitor).visitSectionHeader(this);
  } else {
    return visitor.visitChildren(this);
  }
}
 
Example #12
Source File: EditorConfigParser.java    From editorconfig-netbeans with MIT License 5 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
  if (visitor instanceof EditorConfigParserVisitor) {
    return ((EditorConfigParserVisitor<? extends T>) visitor).visitRootPropertyStatement(this);
  } else {
    return visitor.visitChildren(this);
  }
}
 
Example #13
Source File: EditorConfigParser.java    From editorconfig-netbeans with MIT License 5 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
  if (visitor instanceof EditorConfigParserVisitor) {
    return ((EditorConfigParserVisitor<? extends T>) visitor).visitPropertyStatement(this);
  } else {
    return visitor.visitChildren(this);
  }
}
 
Example #14
Source File: EditorConfigParser.java    From editorconfig-netbeans with MIT License 5 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
  if (visitor instanceof EditorConfigParserVisitor) {
    return ((EditorConfigParserVisitor<? extends T>) visitor).visitPropertyKey(this);
  } else {
    return visitor.visitChildren(this);
  }
}
 
Example #15
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitPredicate(this);
	else return visitor.visitChildren(this);
}
 
Example #16
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitFunctionCall(this);
	else return visitor.visitChildren(this);
}
 
Example #17
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitUnionExprNoRoot(this);
	else return visitor.visitChildren(this);
}
 
Example #18
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitPathExprNoRoot(this);
	else return visitor.visitChildren(this);
}
 
Example #19
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitFilterExpr(this);
	else return visitor.visitChildren(this);
}
 
Example #20
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitOrExpr(this);
	else return visitor.visitChildren(this);
}
 
Example #21
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitAndExpr(this);
	else return visitor.visitChildren(this);
}
 
Example #22
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitEqualityExpr(this);
	else return visitor.visitChildren(this);
}
 
Example #23
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitRelationalExpr(this);
	else return visitor.visitChildren(this);
}
 
Example #24
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitAdditiveExpr(this);
	else return visitor.visitChildren(this);
}
 
Example #25
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitMultiplicativeExpr(this);
	else return visitor.visitChildren(this);
}
 
Example #26
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitUnaryExprNoRoot(this);
	else return visitor.visitChildren(this);
}
 
Example #27
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitNCName(this);
	else return visitor.visitChildren(this);
}
 
Example #28
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitQName(this);
	else return visitor.visitChildren(this);
}
 
Example #29
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitFunctionName(this);
	else return visitor.visitChildren(this);
}
 
Example #30
Source File: XpathParser.java    From JsoupXpath with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
	if ( visitor instanceof XpathVisitor ) return ((XpathVisitor<? extends T>)visitor).visitVariableReference(this);
	else return visitor.visitChildren(this);
}