Program: 178268
Project: 178268
Buggy source:
private int identifier(int c,boolean commandState) throws IOException {
  if (!isIdentifierChar(c)) {
    String badChar="String_Node_Str" + Integer.toOctalString(c & 0xff);
    throw new SyntaxException(PID.CHARACTER_BAD,getPosition(),getCurrentLine(),"String_Node_Str" + badChar + "String_Node_Str"+ (char)c+ "String_Node_Str",badChar);
  }
  tokenBuffer.setLength(0);
  int first=c;
  boolean wasNewline=src.wasBeginOfLine();
  c=getIdentifier(c);
  boolean lastBangOrPredicate=false;
  if (c == '!' || c == '?') {
    if (!src.peek('=')) {
      lastBangOrPredicate=true;
      tokenBuffer.append(c);
    }
 else {
      src.unread(c);
    }
  }
 else {
    src.unread(c);
  }
  src.setIsANewLine(wasNewline);
  int result=0;
  LexState last_state=lex_state;
  if (lastBangOrPredicate) {
    result=Tokens.tFID;
  }
 else {
    if (lex_state == LexState.EXPR_FNAME) {
      if ((c=src.read()) == '=') {
        int c2=src.read();
        if (c2 != '~' && c2 != '>' && (c2 != '=' || (c2 == '\n' && src.peek('>')))) {
          result=Tokens.tIDENTIFIER;
          tokenBuffer.append(c);
          src.unread(c2);
        }
 else {
          src.unread(c2);
          src.unread(c);
        }
      }
 else {
        src.unread(c);
      }
    }
    if (result == 0 && Character.isUpperCase(first)) {
      result=Tokens.tCONSTANT;
    }
 else {
      result=Tokens.tIDENTIFIER;
    }
  }
  String tempVal=tokenBuffer.toString().intern();
  if (!isOneEight && ((lex_state == LexState.EXPR_BEG && !commandState) || lex_state == LexState.EXPR_ARG || lex_state == LexState.EXPR_CMDARG)) {
    int c2=src.read();
    if (c2 == ':' && !src.peek(':')) {
      src.unread(c2);
      setState(LexState.EXPR_BEG);
      src.read();
      yaccValue=new Token(tempVal,getPosition());
      return Tokens.tLABEL;
    }
    src.unread(c2);
  }
  if (lex_state != LexState.EXPR_DOT) {
    Keyword keyword=getKeyword(tempVal);
    if (keyword != null && (keyword != Keyword.__ENCODING__ || !isOneEight)) {
      LexState state=lex_state;
      if (!isOneEight && keyword == Keyword.NOT) {
        setState(LexState.EXPR_ARG);
      }
 else {
        setState(keyword.state);
      }
      if (state == LexState.EXPR_FNAME) {
        yaccValue=new Token(keyword.name,getPosition());
      }
 else {
        yaccValue=new Token(tempVal,getPosition());
        if (keyword.id0 == Tokens.kDO)         return doKeyword(state);
      }
      if (state == LexState.EXPR_BEG || (!isOneEight && state == LexState.EXPR_VALUE))       return keyword.id0;
      if (keyword.id0 != keyword.id1)       setState(LexState.EXPR_BEG);
      return keyword.id1;
    }
  }
  if (isBEG() || lex_state == LexState.EXPR_DOT || isARG()) {
    setState(commandState ? LexState.EXPR_CMDARG : LexState.EXPR_ARG);
  }
 else   if (!isOneEight && lex_state == LexState.EXPR_ENDFN) {
    setState(LexState.EXPR_ENDFN);
  }
 else {
    setState(LexState.EXPR_END);
  }
  return identifierToken(last_state,result,tempVal);
}

Fixed version (ground truth):
private int identifier(int c,boolean commandState) throws IOException {
  if (!isIdentifierChar(c)) {
    String badChar="String_Node_Str" + Integer.toOctalString(c & 0xff);
    throw new SyntaxException(PID.CHARACTER_BAD,getPosition(),getCurrentLine(),"String_Node_Str" + badChar + "String_Node_Str"+ (char)c+ "String_Node_Str",badChar);
  }
  tokenBuffer.setLength(0);
  int first=c;
  boolean wasNewline=src.wasBeginOfLine();
  c=getIdentifier(c);
  boolean lastBangOrPredicate=false;
  if (c == '!' || c == '?') {
    if (!src.peek('=')) {
      lastBangOrPredicate=true;
      tokenBuffer.append(c);
    }
 else {
      src.unread(c);
    }
  }
 else {
    src.unread(c);
  }
  src.setIsANewLine(wasNewline);
  int result=0;
  LexState last_state=lex_state;
  if (lastBangOrPredicate) {
    result=Tokens.tFID;
  }
 else {
    if (lex_state == LexState.EXPR_FNAME) {
      if ((c=src.read()) == '=') {
        int c2=src.read();
        if (c2 != '~' && c2 != '>' && (c2 != '=' || (c2 == '\n' && src.peek('>')))) {
          result=Tokens.tIDENTIFIER;
          tokenBuffer.append(c);
          src.unread(c2);
        }
 else {
          src.unread(c2);
          src.unread(c);
        }
      }
 else {
        src.unread(c);
      }
    }
    if (result == 0 && Character.isUpperCase(first)) {
      result=Tokens.tCONSTANT;
    }
 else {
      result=Tokens.tIDENTIFIER;
    }
  }
  String tempVal=tokenBuffer.toString().intern();
  if (!isOneEight && ((lex_state == LexState.EXPR_BEG && !commandState) || lex_state == LexState.EXPR_ARG || lex_state == LexState.EXPR_CMDARG)) {
    int c2=src.read();
    if (c2 == ':' && !src.peek(':')) {
      src.unread(c2);
      setState(LexState.EXPR_BEG);
      src.read();
      yaccValue=new Token(tempVal,Tokens.tLABEL,getPosition());
      return Tokens.tLABEL;
    }
    src.unread(c2);
  }
  if (lex_state != LexState.EXPR_DOT) {
    Keyword keyword=getKeyword(tempVal);
    if (keyword != null && (keyword != Keyword.__ENCODING__ || !isOneEight)) {
      LexState state=lex_state;
      if (!isOneEight && keyword == Keyword.NOT) {
        setState(LexState.EXPR_ARG);
      }
 else {
        setState(keyword.state);
      }
      if (state == LexState.EXPR_FNAME) {
        yaccValue=new Token(keyword.name,getPosition());
      }
 else {
        yaccValue=new Token(tempVal,getPosition());
        if (keyword.id0 == Tokens.kDO)         return doKeyword(state);
      }
      if (state == LexState.EXPR_BEG || (!isOneEight && state == LexState.EXPR_VALUE))       return keyword.id0;
      if (keyword.id0 != keyword.id1)       setState(LexState.EXPR_BEG);
      return keyword.id1;
    }
  }
  if (isBEG() || lex_state == LexState.EXPR_DOT || isARG()) {
    setState(commandState ? LexState.EXPR_CMDARG : LexState.EXPR_ARG);
  }
 else   if (!isOneEight && lex_state == LexState.EXPR_ENDFN) {
    setState(LexState.EXPR_ENDFN);
  }
 else {
    setState(LexState.EXPR_END);
  }
  return identifierToken(last_state,result,tempVal);
}