kernel/src/main/java/org/kframework/parser/inner/kernel/EarleyParser.java
/**
   * @param data The {@link ParserMetadata} about the sentence being parsed
   * @param k The end-index at which a parse error occurred. In other words, the index just prior to the first token that
   *          did not parse.
   */
@param data The  ParserMetadata about the sentence being parsed
@param k The end-index at which a parse error occurred. In other words, the index just prior to the first token that
did not parse.
@param data The ParserMetadata about the sentence being parsed @param k The end - index at which a parse error occurred . In other words the index just prior to the first token that did not parse .
private void parseError(ParserMetadata data, int k) {
    int startLine, startColumn, endLine, endColumn;
    if (data.words.length == 1) {
      startLine = data.lines[0];
      startColumn = data.columns[0];
      endLine = data.lines[0];
      endColumn = data.columns[0];
    } else {
      Scanner.Token t = data.words[k];
      startLine = data.lines[t.startLoc];
      startColumn = data.columns[t.startLoc];
      endLine = data.lines[t.endLoc];
      endColumn = data.columns[t.endLoc];
    }
    String msg = data.words.length-1 == k ?
        "Parse error: unexpected end of file" :
        "Parse error: unexpected token '" + data.words[k].value + "'";
    if (k != 0) {
      msg = msg + " following token '" + data.words[k - 1].value + "'.";
    } else {
      msg = msg + ".";
    }
    Location loc = new Location(startLine, startColumn,
            endLine, endColumn);
    throw KEMException.innerParserError(msg, data.source, loc);
  }
private void parseError ( ParserMetadata data , int k ) { int startLine , startColumn , endLine , endColumn ; if ( data . words . length == 1 ) { startLine = data . lines [ 0 ] ; startColumn = data . columns [ 0 ] ; endLine = data . lines [ 0 ] ; endColumn = data . columns [ 0 ] ; } else { Scanner . Token t = data . words [ k ] ; startLine = data . lines [ t . startLoc ] ; startColumn = data . columns [ t . startLoc ] ; endLine = data . lines [ t . endLoc ] ; endColumn = data . columns [ t . endLoc ] ; } String msg = data . words . length - 1 == k ? "Parse error: unexpected end of file" : "Parse error: unexpected token '" + data . words [ k ] . value + "'" ; if ( k != 0 ) { msg = msg + " following token '" + data . words [ k - 1 ] . value + "'." ; } else { msg = msg + "." ; } Location loc = new Location ( startLine , startColumn , endLine , endColumn ) ; throw KEMException . innerParserError ( msg , data . source , loc ) ; }
@param data The {@link ParserMetadata} about the sentence being parsed
 @param k The end-index at which a parse error occurred.
@param data The { @link ParserMetadata } about the sentence being parsed @param k The end - index at which a parse error occurred .