Convenience routine to return the specified error's
underlying SyntaxException, or null if it isn't one.
178245
public SyntaxException getSyntaxError(int index) {
        SyntaxException exception = null;

        Message message = getError(index);
        if (message != null && message instanceof SyntaxErrorMessage) {
            exception = ((SyntaxErrorMessage) message).getCause();
        }
        return exception;
    }
1297291
def syntax_error(message)
      column = @orig_line && @line ? @orig_line.size - @line.size : 0
      raise SyntaxError.new(message, file_path, @orig_line, @lineno, column)
    end
46930
static void showError(Exception e) {
    String stackTrace = org.languagetool.tools.Tools.getFullStackTrace(e);
    String msg = "<html><p style='width: 600px;'>" + StringTools.escapeHTML(stackTrace);
    JOptionPane.showMessageDialog(null, msg, "Error", JOptionPane.ERROR_MESSAGE);
    e.printStackTrace();
  }
1307194
def parse_error(
        self, exception=ParseError, *args
    ):  # type: (ParseError.__class__, ...) -> ParseError
        
        line, col = self._to_linecol()

        return exception(line, col, *args)
1103270
def make_syntax_err(self, err, original):
        """"""
        msg, loc = err.args
        return self.make_err(CoconutSyntaxError, msg, original, loc)
1150195
public EvalError toEvalError(
        String msg, SimpleNode node, CallStack callstack  )
    {
        if ( Interpreter.DEBUG.get() )
            printStackTrace();

        if ( msg == null )
            msg = "";
        else
            msg += ": ";
        return new EvalError( msg + this.getMessage(), node, callstack, this );
    }
916919
private function syntaxError(): void
    {
        throw new SyntaxErrorException(
            $this->lexer->getInputUntilPosition(PHP_INT_MAX),
            $this->lexer->lookahead['value'] ?: 'end of string',
            (int) $this->lexer->lookahead['position']
        );
    }
49577
function error(original, fileName) {
  if (
    original == null ||
    original.location == null ||
    original.location.start == null
  ) {
    return original;
  }

  const start = original.location.start;
  const lineNumber = start.line == null ? 1 : start.line;
  const columnNumber = start.column == null ? 1 : start.column;
  const err = new SyntaxError(`Line ${lineNumber}, column ${columnNumber}: ${original.message}`);

  Object.assign(err, {fileName, lineNumber, columnNumber, original});

  if (fileName == null) {
    return err;
  }

  err.stack = `SyntaxError: ${err.message}\n
    at ${fileName}:${lineNumber}:${columnNumber}
  `;

  return err;
}
779109
private IOException syntaxError(String message) throws IOException {
    throw new MalformedJsonException(message
        + " at line " + getLineNumber() + " column " + getColumnNumber() + " path " + getPath());
  }
413867
def syntax_error!(message, args = {})
      args[:orig_line] ||= @orig_line
      args[:line] ||= @line
      args[:lineno] ||= @lineno
      args[:column] ||= args[:orig_line] && args[:line] ?
                        args[:orig_line].size - args[:line].size : 0
      raise SyntaxError.new(message, options[:file],
                            args[:orig_line], args[:lineno], args[:column])
    end
865535
def _get_error_context(input_, token):
    

    try:
        line = input_[token.lexpos: input_.index('\n', token.lexpos)]
    except ValueError:
        line = input_[token.lexpos:]

    i = input_.rfind('\n', 0, token.lexpos)
    if i < 0:
        i = 0
    line = input_[i:token.lexpos] + line
    lines = [line.strip('\r\n')]
    col = token.lexpos - i
    while len(lines) < 5 and i > 0:
        end = i
        i = input_.rfind('\n', 0, i)
        if i < 0:
            i = 0
        lines.insert(0, input_[i:end].strip('\r\n'))
    pointer = ''
    for dummy_ch in str(token.value):
        pointer += '^'
    pointline = ''
    i = 0
    while i < col - 1:
        if lines[-1][i].isspace():
            pointline += lines[-1][i]
            # otherwise, tabs complicate the alignment
        else:
            pointline += ' '
        i += 1
    lines.append(pointline + pointer)
    return lines
18525
private void generateSyntaxErrorMessage(SourceUnit sourceUnit, AnnotationNode node, String msg) {
        SyntaxException error = new SyntaxException(msg, node.getLineNumber(), node.getColumnNumber());
        sourceUnit.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(error, sourceUnit));
    }
1009526
synchronized void error(@NotNull Exception e) {
        if (isFinished) {
            throw new RuntimeException("Promise already completed!");
        }
        if (e == null) {
            throw new RuntimeException("Error can't be null");
        }
        isFinished = true;
        exception = e;
        deliverResult();
    }
1241501
public void recordParsingException(CqlTranslatorException e) {
        addException(e);
        if (shouldReport(e.getSeverity())) {
            CqlToElmError err = af.createCqlToElmError();
            err.setMessage(e.getMessage());
            err.setErrorType(e instanceof CqlSyntaxException ? ErrorType.SYNTAX : (e instanceof CqlSemanticException ? ErrorType.SEMANTIC : ErrorType.INTERNAL));
            err.setErrorSeverity(toErrorSeverity(e.getSeverity()));
            if (e.getLocator() != null) {
                err.setStartLine(e.getLocator().getStartLine());
                err.setEndLine(e.getLocator().getEndLine());
                err.setStartChar(e.getLocator().getStartChar());
                err.setEndChar(e.getLocator().getEndChar());
            }

            if (e.getCause() != null && e.getCause() instanceof CqlTranslatorIncludeException) {
                CqlTranslatorIncludeException incEx = (CqlTranslatorIncludeException) e.getCause();
                err.setTargetIncludeLibraryId(incEx.getLibraryId());
                err.setTargetIncludeLibraryVersionId(incEx.getVersionId());
                err.setErrorType(ErrorType.INCLUDE);
            }
            library.getAnnotation().add(err);
        }
    }
959072
protected JCErroneous syntaxError(String key, TokenKind arg) {
        return syntaxError(token.pos, key, arg);
    }
224631
public void addError(SyntaxException error, SourceUnit source) throws CompilationFailedException {
        addError(Message.create(error, source), error.isFatal());
    }
1015663
public static String getValidationError(String code, Object... msgValues) {
        if (!_MESSAGES.containsKey(code))
            throw new RuntimeException("Unknown code: " + code);
        return fillMessage(_MESSAGES.get(code), msgValues);
    }