Java Code Examples for org.antlr.v4.runtime.tree.ErrorNode#getSymbol()

The following examples show how to use org.antlr.v4.runtime.tree.ErrorNode#getSymbol() . 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: F5BigipStructuredConfigurationBuilder.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Override
public void visitErrorNode(ErrorNode errorNode) {
  Token token = errorNode.getSymbol();
  int line = token.getLine();
  String lineText = errorNode.getText().replace("\n", "").replace("\r", "").trim();
  _c.setUnrecognized(true);

  if (token instanceof UnrecognizedLineToken) {
    UnrecognizedLineToken unrecToken = (UnrecognizedLineToken) token;
    _w.getParseWarnings()
        .add(
            new ParseWarning(
                line, lineText, unrecToken.getParserContext(), "This syntax is unrecognized"));
  } else {
    String msg = String.format("Unrecognized Line: %d: %s", line, lineText);
    _w.redFlag(msg + " SUBSEQUENT LINES MAY NOT BE PROCESSED CORRECTLY");
  }
}
 
Example 2
Source File: CumulusNcluConfigurationBuilder.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Override
public void visitErrorNode(ErrorNode errorNode) {
  Token token = errorNode.getSymbol();
  int line = token.getLine();
  String lineText = errorNode.getText().replace("\n", "").replace("\r", "").trim();

  if (token instanceof UnrecognizedLineToken) {
    UnrecognizedLineToken unrecToken = (UnrecognizedLineToken) token;
    ParseWarning warning =
        new ParseWarning(
            line, lineText, unrecToken.getParserContext(), "This syntax is unrecognized");
    unrecognized(warning, null);
  } else {
    String msg = String.format("Unrecognized Line: %d: %s", line, lineText);
    _w.redFlag(msg + " Subsequent lines may not be processed correctly");
  }
}
 
Example 3
Source File: CumulusPortsConfigurationBuilder.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Override
public void visitErrorNode(ErrorNode errorNode) {
  Token token = errorNode.getSymbol();
  int line = token.getLine();
  String lineText = errorNode.getText().replace("\n", "").replace("\r", "").trim();
  _config.setUnrecognized(true);

  if (token instanceof UnrecognizedLineToken) {
    UnrecognizedLineToken unrecToken = (UnrecognizedLineToken) token;
    _w.getParseWarnings()
        .add(
            new ParseWarning(
                line, lineText, unrecToken.getParserContext(), "This syntax is unrecognized"));
  } else {
    String msg = String.format("Unrecognized Line: %d: %s", line, lineText);
    _w.redFlag(msg + " SUBSEQUENT LINES MAY NOT BE PROCESSED CORRECTLY");
  }
}
 
Example 4
Source File: CumulusFrrConfigurationBuilder.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Override
public void visitErrorNode(ErrorNode errorNode) {
  Token token = errorNode.getSymbol();
  int line = token.getLine();
  String lineText = errorNode.getText().replace("\n", "").replace("\r", "").trim();
  _c.setUnrecognized(true);

  if (token instanceof UnrecognizedLineToken) {
    UnrecognizedLineToken unrecToken = (UnrecognizedLineToken) token;
    _w.getParseWarnings()
        .add(
            new ParseWarning(
                line, lineText, unrecToken.getParserContext(), "This syntax is unrecognized"));
  } else {
    String msg = String.format("Unrecognized Line: %d: %s", line, lineText);
    _w.redFlag(msg + " SUBSEQUENT LINES MAY NOT BE PROCESSED CORRECTLY");
  }
}
 
Example 5
Source File: CumulusInterfacesConfigurationBuilder.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Override
public void visitErrorNode(ErrorNode errorNode) {
  Token token = errorNode.getSymbol();
  int line = token.getLine();
  String lineText = errorNode.getText().replace("\n", "").replace("\r", "").trim();
  _config.setUnrecognized(true);

  if (token instanceof UnrecognizedLineToken) {
    UnrecognizedLineToken unrecToken = (UnrecognizedLineToken) token;
    _w.getParseWarnings()
        .add(
            new ParseWarning(
                line, lineText, unrecToken.getParserContext(), "This syntax is unrecognized"));
  } else {
    String msg = String.format("Unrecognized Line: %d: %s", line, lineText);
    _w.redFlag(msg + " SUBSEQUENT LINES MAY NOT BE PROCESSED CORRECTLY");
  }
}
 
Example 6
Source File: PaloAltoConfigurationBuilder.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Override
public void visitErrorNode(ErrorNode errorNode) {
  Token token = errorNode.getSymbol();
  String lineText = getText(errorNode).replace("\n", "").replace("\r", "").trim();
  int line = getLine(token);
  _mainConfiguration.setUnrecognized(true);

  if (token instanceof UnrecognizedLineToken) {
    UnrecognizedLineToken unrecToken = (UnrecognizedLineToken) token;
    _w.getParseWarnings()
        .add(
            new ParseWarning(
                line, lineText, unrecToken.getParserContext(), "This syntax is unrecognized"));
  } else {
    String msg = String.format("Unrecognized Line: %d: %s", line, lineText);
    _w.redFlag(msg + " SUBSEQUENT LINES MAY NOT BE PROCESSED CORRECTLY");
  }
}
 
Example 7
Source File: F5BigipImishConfigurationBuilder.java    From batfish with Apache License 2.0 6 votes vote down vote up
@Override
public void visitErrorNode(ErrorNode errorNode) {
  Token token = errorNode.getSymbol();
  int line = token.getLine();
  String lineText = errorNode.getText().replace("\n", "").replace("\r", "").trim();
  _c.setUnrecognized(true);

  if (token instanceof UnrecognizedLineToken) {
    UnrecognizedLineToken unrecToken = (UnrecognizedLineToken) token;
    _w.getParseWarnings()
        .add(
            new ParseWarning(
                line, lineText, unrecToken.getParserContext(), "This syntax is unrecognized"));
  } else {
    String msg = String.format("Unrecognized Line: %d: %s", line, lineText);
    _w.redFlag(msg + " SUBSEQUENT LINES MAY NOT BE PROCESSED CORRECTLY");
  }
}