Program: 28129
Project: 28129
Buggy source:
/** 
 * Parses a   {@link JSDocInfo} object. This parsing method reads all tokensreturned by the  {@link JsDocTokenStream#getJsDocToken()} method until the{@link JsDocToken#EOC} is returned.
 * @return {@code true} if JSDoc information was correctly parsed,{@code false} otherwise
 */
boolean parse(){
  int lineno;
  int charno;
  JSTypeExpression type;
  state=State.SEARCHING_ANNOTATION;
  skipEOLs();
  JsDocToken token=next();
  List<ExtendedTypeInfo> extendedTypes=Lists.newArrayList();
  if (jsdocBuilder.shouldParseDocumentation()) {
    ExtractionInfo blockInfo=extractBlockComment(token);
    token=blockInfo.token;
    if (!blockInfo.string.isEmpty()) {
      jsdocBuilder.recordBlockDescription(blockInfo.string);
    }
  }
 else {
    if (token != JsDocToken.ANNOTATION && token != JsDocToken.EOC) {
      jsdocBuilder.recordBlockDescription("String_Node_Str");
    }
  }
  retry:   for (; ; ) {
switch (token) {
case ANNOTATION:
      if (state == State.SEARCHING_ANNOTATION) {
        state=State.SEARCHING_NEWLINE;
        lineno=stream.getLineno();
        charno=stream.getCharno();
        String annotationName=stream.getString();
        Annotation annotation=annotationNames.get(annotationName);
        if (annotation == null) {
          parser.addParserWarning("String_Node_Str",annotationName,stream.getLineno(),stream.getCharno());
        }
 else {
          jsdocBuilder.markAnnotation(annotationName,lineno,charno);
switch (annotation) {
case AUTHOR:
            if (jsdocBuilder.shouldParseDocumentation()) {
              ExtractionInfo authorInfo=extractSingleLineBlock();
              String author=authorInfo.string;
              if (author.length() == 0) {
                parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
              }
 else {
                jsdocBuilder.addAuthor(author);
              }
              token=authorInfo.token;
            }
 else {
              token=eatTokensUntilEOL(token);
            }
          continue retry;
case CONSTANT:
        if (!jsdocBuilder.recordConstancy()) {
          parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
        }
      token=eatTokensUntilEOL();
    continue retry;
case CONSTRUCTOR:
  if (!jsdocBuilder.recordConstructor()) {
    if (jsdocBuilder.isInterfaceRecorded()) {
      parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
    }
 else {
      parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
    }
  }
token=eatTokensUntilEOL();
continue retry;
case DEPRECATED:
if (!jsdocBuilder.recordDeprecated()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
ExtractionInfo reasonInfo=extractMultilineTextualBlock(token);
String reason=reasonInfo.string;
if (reason.length() > 0) {
jsdocBuilder.recordDeprecationReason(reason);
}
token=reasonInfo.token;
continue retry;
case INTERFACE:
if (!jsdocBuilder.recordInterface()) {
if (jsdocBuilder.isConstructorRecorded()) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
 else {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
token=eatTokensUntilEOL();
continue retry;
case DESC:
if (jsdocBuilder.isDescriptionRecorded()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
token=eatTokensUntilEOL();
continue retry;
}
 else {
ExtractionInfo descriptionInfo=extractMultilineTextualBlock(token);
String description=descriptionInfo.string;
jsdocBuilder.recordDescription(description);
token=descriptionInfo.token;
continue retry;
}
case FILE_OVERVIEW:
String fileOverview="String_Node_Str";
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo fileOverviewInfo=extractMultilineTextualBlock(token,WhitespaceOption.TRIM);
fileOverview=fileOverviewInfo.string;
token=fileOverviewInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
if (!jsdocBuilder.recordFileOverview(fileOverview) || fileOverviewJSDocInfo != null) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
continue retry;
case LICENSE:
case PRESERVE:
ExtractionInfo preserveInfo=extractMultilineTextualBlock(token,WhitespaceOption.PRESERVE);
String preserve=preserveInfo.string;
if (preserve.length() > 0) {
if (fileLevelJsDocBuilder != null) {
fileLevelJsDocBuilder.append(preserve);
}
}
token=preserveInfo.token;
continue retry;
case ENUM:
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
type=null;
if (token != JsDocToken.EOL && token != JsDocToken.EOC) {
type=createJSTypeExpression(parseAndRecordTypeNode(token));
}
if (type == null) {
type=createJSTypeExpression(newStringNode("String_Node_Str"));
}
if (!jsdocBuilder.recordEnumParameterType(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
token=eatTokensUntilEOL(token);
continue retry;
case EXPORT:
if (!jsdocBuilder.recordExport()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case EXTERNS:
if (!jsdocBuilder.recordExterns()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case JAVA_DISPATCH:
if (!jsdocBuilder.recordJavaDispatch()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case EXTENDS:
case IMPLEMENTS:
skipEOLs();
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
boolean matchingRc=false;
if (token == JsDocToken.LC) {
token=next();
matchingRc=true;
}
if (token == JsDocToken.STRING) {
Node typeNode=parseAndRecordTypeNameNode(token,lineno,charno,matchingRc);
lineno=stream.getLineno();
charno=stream.getCharno();
typeNode=wrapNode(Token.BANG,typeNode);
if (typeNode != null && !matchingRc) {
typeNode.putBooleanProp(Node.BRACELESS_TYPE,true);
}
type=createJSTypeExpression(typeNode);
if (annotation == Annotation.EXTENDS) {
extendedTypes.add(new ExtendedTypeInfo(type,stream.getLineno(),stream.getCharno()));
}
 else {
Preconditions.checkState(annotation == Annotation.IMPLEMENTS);
if (!jsdocBuilder.recordImplementedInterface(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
}
token=next();
if (matchingRc) {
if (token != JsDocToken.RC) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
 else if (token != JsDocToken.EOL && token != JsDocToken.EOF && token != JsDocToken.EOC) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
 else {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
token=eatTokensUntilEOL(token);
continue retry;
case HIDDEN:
if (!jsdocBuilder.recordHiddenness()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case LENDS:
skipEOLs();
matchingRc=false;
if (match(JsDocToken.LC)) {
token=next();
matchingRc=true;
}
if (match(JsDocToken.STRING)) {
token=next();
if (!jsdocBuilder.recordLends(stream.getString())) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
 else {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
if (matchingRc && !match(JsDocToken.RC)) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case MEANING:
ExtractionInfo meaningInfo=extractMultilineTextualBlock(token);
String meaning=meaningInfo.string;
token=meaningInfo.token;
if (!jsdocBuilder.recordMeaning(meaning)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
continue retry;
case NO_ALIAS:
if (!jsdocBuilder.recordNoAlias()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NO_COMPILE:
if (!jsdocBuilder.recordNoCompile()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NO_TYPE_CHECK:
if (!jsdocBuilder.recordNoTypeCheck()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NOT_IMPLEMENTED:
token=eatTokensUntilEOL();
continue retry;
case INHERIT_DOC:
case OVERRIDE:
if (!jsdocBuilder.recordOverride()) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case THROWS:
skipEOLs();
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
type=null;
if (token == JsDocToken.LC) {
type=createJSTypeExpression(parseAndRecordTypeNode(token));
if (type == null) {
token=eatTokensUntilEOL();
continue retry;
}
}
token=current();
jsdocBuilder.recordThrowType(type);
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo descriptionInfo=extractMultilineTextualBlock(token);
String description=descriptionInfo.string;
if (description.length() > 0) {
jsdocBuilder.recordThrowDescription(type,description);
}
token=descriptionInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
continue retry;
case PARAM:
skipEOLs();
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
type=null;
if (token == JsDocToken.LC) {
type=createJSTypeExpression(parseAndRecordParamTypeNode(token));
if (type == null) {
token=eatTokensUntilEOL();
continue retry;
}
skipEOLs();
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
}
String name=null;
boolean isBracketedParam=JsDocToken.LB == token;
if (isBracketedParam) {
token=next();
}
if (JsDocToken.STRING != token) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
 else {
name=stream.getString();
if (isBracketedParam) {
token=next();
if (JsDocToken.EQUALS == token) {
token=next();
if (JsDocToken.STRING == token) {
token=next();
}
}
if (JsDocToken.RB != token) {
reportTypeSyntaxWarning("String_Node_Str");
}
 else if (type != null) {
type=JSTypeExpression.makeOptionalArg(type);
}
}
if (name.indexOf('.') > -1) {
name=null;
}
 else if (!jsdocBuilder.recordParameter(name,type)) {
if (jsdocBuilder.hasParameter(name)) {
parser.addTypeWarning("String_Node_Str",name,lineno,charno);
}
 else {
parser.addTypeWarning("String_Node_Str",name,lineno,charno);
}
}
}
if (name == null) {
token=eatTokensUntilEOL(token);
continue retry;
}
jsdocBuilder.markName(name,lineno,charno);
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo paramDescriptionInfo=extractMultilineTextualBlock(token);
String paramDescription=paramDescriptionInfo.string;
if (paramDescription.length() > 0) {
jsdocBuilder.recordParameterDescription(name,paramDescription);
}
token=paramDescriptionInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
continue retry;
case PRESERVE_TRY:
if (!jsdocBuilder.recordPreserveTry()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case PRIVATE:
if (!jsdocBuilder.recordVisibility(Visibility.PRIVATE)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case PROTECTED:
if (!jsdocBuilder.recordVisibility(Visibility.PROTECTED)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case PUBLIC:
if (!jsdocBuilder.recordVisibility(Visibility.PUBLIC)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NO_SHADOW:
if (!jsdocBuilder.recordNoShadow()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NO_SIDE_EFFECTS:
if (!jsdocBuilder.recordNoSideEffects()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case MODIFIES:
token=parseModifiesTag(next());
continue retry;
case IMPLICIT_CAST:
if (!jsdocBuilder.recordImplicitCast()) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case SEE:
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo referenceInfo=extractSingleLineBlock();
String reference=referenceInfo.string;
if (reference.length() == 0) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
 else {
jsdocBuilder.addReference(reference);
}
token=referenceInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
continue retry;
case SUPPRESS:
token=parseSuppressTag(next());
continue retry;
case TEMPLATE:
ExtractionInfo templateInfo=extractSingleLineBlock();
String templateTypeName=templateInfo.string;
if (templateTypeName.length() == 0) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
 else if (!jsdocBuilder.recordTemplateTypeName(templateTypeName)) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=templateInfo.token;
continue retry;
case VERSION:
ExtractionInfo versionInfo=extractSingleLineBlock();
String version=versionInfo.string;
if (version.length() == 0) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
 else {
if (!jsdocBuilder.recordVersion(version)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
token=versionInfo.token;
continue retry;
case DEFINE:
case RETURN:
case THIS:
case TYPE:
case TYPEDEF:
lineno=stream.getLineno();
charno=stream.getCharno();
Node typeNode=null;
if (!lookAheadForTypeAnnotation() && annotation == Annotation.RETURN) {
typeNode=newNode(Token.QMARK);
}
 else {
skipEOLs();
token=next();
typeNode=parseAndRecordTypeNode(token,lineno,charno);
}
if (annotation == Annotation.THIS) {
typeNode=wrapNode(Token.BANG,typeNode);
if (typeNode != null && token != JsDocToken.LC) {
typeNode.putBooleanProp(Node.BRACELESS_TYPE,true);
}
}
type=createJSTypeExpression(typeNode);
if (type == null) {
}
 else {
switch (annotation) {
case DEFINE:
if (!jsdocBuilder.recordDefineType(type)) {
parser.addParserWarning("String_Node_Str",lineno,charno);
}
break;
case RETURN:
if (!jsdocBuilder.recordReturnType(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
break;
}
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo returnDescriptionInfo=extractMultilineTextualBlock(token);
String returnDescription=returnDescriptionInfo.string;
if (returnDescription.length() > 0) {
jsdocBuilder.recordReturnDescription(returnDescription);
}
token=returnDescriptionInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
continue retry;
case THIS:
if (!jsdocBuilder.recordThisType(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
break;
case TYPE:
if (!jsdocBuilder.recordType(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
break;
case TYPEDEF:
if (!jsdocBuilder.recordTypedef(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
break;
}
token=eatTokensUntilEOL();
}
continue retry;
}
}
}
break;
case EOC:
if (hasParsedFileOverviewDocInfo()) {
fileOverviewJSDocInfo=retrieveAndResetParsedJSDocInfo();
}
checkExtendedTypes(extendedTypes);
return true;
case EOF:
jsdocBuilder.build(null);
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
checkExtendedTypes(extendedTypes);
return false;
case EOL:
if (state == State.SEARCHING_NEWLINE) {
state=State.SEARCHING_ANNOTATION;
}
token=next();
continue retry;
default :
if (token == JsDocToken.STAR && state == State.SEARCHING_ANNOTATION) {
token=next();
continue retry;
}
 else {
state=State.SEARCHING_NEWLINE;
token=eatTokensUntilEOL();
continue retry;
}
}
token=next();
}
}

Fixed version (ground truth):
/** 
 * Parses a   {@link JSDocInfo} object. This parsing method reads all tokensreturned by the  {@link JsDocTokenStream#getJsDocToken()} method until the{@link JsDocToken#EOC} is returned.
 * @return {@code true} if JSDoc information was correctly parsed,{@code false} otherwise
 */
boolean parse(){
  int lineno;
  int charno;
  JSTypeExpression type;
  state=State.SEARCHING_ANNOTATION;
  skipEOLs();
  JsDocToken token=next();
  List<ExtendedTypeInfo> extendedTypes=Lists.newArrayList();
  if (jsdocBuilder.shouldParseDocumentation()) {
    ExtractionInfo blockInfo=extractBlockComment(token);
    token=blockInfo.token;
    if (!blockInfo.string.isEmpty()) {
      jsdocBuilder.recordBlockDescription(blockInfo.string);
    }
  }
 else {
    if (token != JsDocToken.ANNOTATION && token != JsDocToken.EOC) {
      jsdocBuilder.recordBlockDescription("String_Node_Str");
    }
  }
  retry:   for (; ; ) {
switch (token) {
case ANNOTATION:
      if (state == State.SEARCHING_ANNOTATION) {
        state=State.SEARCHING_NEWLINE;
        lineno=stream.getLineno();
        charno=stream.getCharno();
        String annotationName=stream.getString();
        Annotation annotation=annotationNames.get(annotationName);
        if (annotation == null) {
          parser.addParserWarning("String_Node_Str",annotationName,stream.getLineno(),stream.getCharno());
        }
 else {
          jsdocBuilder.markAnnotation(annotationName,lineno,charno);
switch (annotation) {
case AUTHOR:
            if (jsdocBuilder.shouldParseDocumentation()) {
              ExtractionInfo authorInfo=extractSingleLineBlock();
              String author=authorInfo.string;
              if (author.length() == 0) {
                parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
              }
 else {
                jsdocBuilder.addAuthor(author);
              }
              token=authorInfo.token;
            }
 else {
              token=eatTokensUntilEOL(token);
            }
          continue retry;
case CONSTANT:
        if (!jsdocBuilder.recordConstancy()) {
          parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
        }
      token=eatTokensUntilEOL();
    continue retry;
case CONSTRUCTOR:
  if (!jsdocBuilder.recordConstructor()) {
    if (jsdocBuilder.isInterfaceRecorded()) {
      parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
    }
 else {
      parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
    }
  }
token=eatTokensUntilEOL();
continue retry;
case DEPRECATED:
if (!jsdocBuilder.recordDeprecated()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
ExtractionInfo reasonInfo=extractMultilineTextualBlock(token);
String reason=reasonInfo.string;
if (reason.length() > 0) {
jsdocBuilder.recordDeprecationReason(reason);
}
token=reasonInfo.token;
continue retry;
case INTERFACE:
if (!jsdocBuilder.recordInterface()) {
if (jsdocBuilder.isConstructorRecorded()) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
 else {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
token=eatTokensUntilEOL();
continue retry;
case DESC:
if (jsdocBuilder.isDescriptionRecorded()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
token=eatTokensUntilEOL();
continue retry;
}
 else {
ExtractionInfo descriptionInfo=extractMultilineTextualBlock(token);
String description=descriptionInfo.string;
jsdocBuilder.recordDescription(description);
token=descriptionInfo.token;
continue retry;
}
case FILE_OVERVIEW:
String fileOverview="String_Node_Str";
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo fileOverviewInfo=extractMultilineTextualBlock(token,WhitespaceOption.TRIM);
fileOverview=fileOverviewInfo.string;
token=fileOverviewInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
if (!jsdocBuilder.recordFileOverview(fileOverview) || fileOverviewJSDocInfo != null) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
continue retry;
case LICENSE:
case PRESERVE:
ExtractionInfo preserveInfo=extractMultilineTextualBlock(token,WhitespaceOption.PRESERVE);
String preserve=preserveInfo.string;
if (preserve.length() > 0) {
if (fileLevelJsDocBuilder != null) {
fileLevelJsDocBuilder.append(preserve);
}
}
token=preserveInfo.token;
continue retry;
case ENUM:
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
type=null;
if (token != JsDocToken.EOL && token != JsDocToken.EOC) {
type=createJSTypeExpression(parseAndRecordTypeNode(token));
}
if (type == null) {
type=createJSTypeExpression(newStringNode("String_Node_Str"));
}
if (!jsdocBuilder.recordEnumParameterType(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
token=eatTokensUntilEOL(token);
continue retry;
case EXPORT:
if (!jsdocBuilder.recordExport()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case EXTERNS:
if (!jsdocBuilder.recordExterns()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case JAVA_DISPATCH:
if (!jsdocBuilder.recordJavaDispatch()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case EXTENDS:
case IMPLEMENTS:
skipEOLs();
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
boolean matchingRc=false;
if (token == JsDocToken.LC) {
token=next();
matchingRc=true;
}
if (token == JsDocToken.STRING) {
Node typeNode=parseAndRecordTypeNameNode(token,lineno,charno,matchingRc);
lineno=stream.getLineno();
charno=stream.getCharno();
typeNode=wrapNode(Token.BANG,typeNode);
if (typeNode != null && !matchingRc) {
typeNode.putBooleanProp(Node.BRACELESS_TYPE,true);
}
type=createJSTypeExpression(typeNode);
if (annotation == Annotation.EXTENDS) {
extendedTypes.add(new ExtendedTypeInfo(type,stream.getLineno(),stream.getCharno()));
}
 else {
Preconditions.checkState(annotation == Annotation.IMPLEMENTS);
if (!jsdocBuilder.recordImplementedInterface(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
}
token=next();
if (matchingRc) {
if (token != JsDocToken.RC) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
 else if (token != JsDocToken.EOL && token != JsDocToken.EOF && token != JsDocToken.EOC) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
 else {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
token=eatTokensUntilEOL(token);
continue retry;
case HIDDEN:
if (!jsdocBuilder.recordHiddenness()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case LENDS:
skipEOLs();
matchingRc=false;
if (match(JsDocToken.LC)) {
token=next();
matchingRc=true;
}
if (match(JsDocToken.STRING)) {
token=next();
if (!jsdocBuilder.recordLends(stream.getString())) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
 else {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
if (matchingRc && !match(JsDocToken.RC)) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case MEANING:
ExtractionInfo meaningInfo=extractMultilineTextualBlock(token);
String meaning=meaningInfo.string;
token=meaningInfo.token;
if (!jsdocBuilder.recordMeaning(meaning)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
continue retry;
case NO_ALIAS:
if (!jsdocBuilder.recordNoAlias()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NO_COMPILE:
if (!jsdocBuilder.recordNoCompile()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NO_TYPE_CHECK:
if (!jsdocBuilder.recordNoTypeCheck()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NOT_IMPLEMENTED:
token=eatTokensUntilEOL();
continue retry;
case INHERIT_DOC:
case OVERRIDE:
if (!jsdocBuilder.recordOverride()) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case THROWS:
skipEOLs();
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
type=null;
if (token == JsDocToken.LC) {
type=createJSTypeExpression(parseAndRecordTypeNode(token));
if (type == null) {
token=eatTokensUntilEOL();
continue retry;
}
}
token=current();
jsdocBuilder.recordThrowType(type);
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo descriptionInfo=extractMultilineTextualBlock(token);
String description=descriptionInfo.string;
if (description.length() > 0) {
jsdocBuilder.recordThrowDescription(type,description);
}
token=descriptionInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
continue retry;
case PARAM:
skipEOLs();
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
type=null;
if (token == JsDocToken.LC) {
type=createJSTypeExpression(parseAndRecordParamTypeNode(token));
if (type == null) {
token=eatTokensUntilEOL();
continue retry;
}
skipEOLs();
token=next();
lineno=stream.getLineno();
charno=stream.getCharno();
}
String name=null;
boolean isBracketedParam=JsDocToken.LB == token;
if (isBracketedParam) {
token=next();
}
if (JsDocToken.STRING != token) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
 else {
name=stream.getString();
if (isBracketedParam) {
token=next();
if (JsDocToken.EQUALS == token) {
token=next();
if (JsDocToken.STRING == token) {
token=next();
}
}
if (JsDocToken.RB != token) {
reportTypeSyntaxWarning("String_Node_Str");
}
 else if (type != null) {
type=JSTypeExpression.makeOptionalArg(type);
}
}
if (name.indexOf('.') > -1) {
name=null;
}
 else if (!jsdocBuilder.recordParameter(name,type)) {
if (jsdocBuilder.hasParameter(name)) {
parser.addTypeWarning("String_Node_Str",name,lineno,charno);
}
 else {
parser.addTypeWarning("String_Node_Str",name,lineno,charno);
}
}
}
if (name == null) {
token=eatTokensUntilEOL(token);
continue retry;
}
jsdocBuilder.markName(name,lineno,charno);
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo paramDescriptionInfo=extractMultilineTextualBlock(token);
String paramDescription=paramDescriptionInfo.string;
if (paramDescription.length() > 0) {
jsdocBuilder.recordParameterDescription(name,paramDescription);
}
token=paramDescriptionInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
continue retry;
case PRESERVE_TRY:
if (!jsdocBuilder.recordPreserveTry()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case PRIVATE:
if (!jsdocBuilder.recordVisibility(Visibility.PRIVATE)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case PROTECTED:
if (!jsdocBuilder.recordVisibility(Visibility.PROTECTED)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case PUBLIC:
if (!jsdocBuilder.recordVisibility(Visibility.PUBLIC)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NO_SHADOW:
if (!jsdocBuilder.recordNoShadow()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case NO_SIDE_EFFECTS:
if (!jsdocBuilder.recordNoSideEffects()) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case MODIFIES:
token=parseModifiesTag(next());
continue retry;
case IMPLICIT_CAST:
if (!jsdocBuilder.recordImplicitCast()) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=eatTokensUntilEOL();
continue retry;
case SEE:
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo referenceInfo=extractSingleLineBlock();
String reference=referenceInfo.string;
if (reference.length() == 0) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
 else {
jsdocBuilder.addReference(reference);
}
token=referenceInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
continue retry;
case SUPPRESS:
token=parseSuppressTag(next());
continue retry;
case TEMPLATE:
ExtractionInfo templateInfo=extractSingleLineBlock();
String templateTypeName=templateInfo.string;
if (templateTypeName.length() == 0) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
 else if (!jsdocBuilder.recordTemplateTypeName(templateTypeName)) {
parser.addTypeWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
token=templateInfo.token;
continue retry;
case VERSION:
ExtractionInfo versionInfo=extractSingleLineBlock();
String version=versionInfo.string;
if (version.length() == 0) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
 else {
if (!jsdocBuilder.recordVersion(version)) {
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
}
}
token=versionInfo.token;
continue retry;
case DEFINE:
case RETURN:
case THIS:
case TYPE:
case TYPEDEF:
lineno=stream.getLineno();
charno=stream.getCharno();
Node typeNode=null;
if (!lookAheadForTypeAnnotation() && annotation == Annotation.RETURN) {
typeNode=newNode(Token.QMARK);
}
 else {
skipEOLs();
token=next();
typeNode=parseAndRecordTypeNode(token,lineno,charno);
}
if (annotation == Annotation.THIS) {
typeNode=wrapNode(Token.BANG,typeNode);
if (typeNode != null && token != JsDocToken.LC) {
typeNode.putBooleanProp(Node.BRACELESS_TYPE,true);
}
}
type=createJSTypeExpression(typeNode);
if (type == null) {
}
 else {
switch (annotation) {
case DEFINE:
if (!jsdocBuilder.recordDefineType(type)) {
parser.addParserWarning("String_Node_Str",lineno,charno);
}
break;
case RETURN:
if (!jsdocBuilder.recordReturnType(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
break;
}
if (jsdocBuilder.shouldParseDocumentation()) {
ExtractionInfo returnDescriptionInfo=extractMultilineTextualBlock(token);
String returnDescription=returnDescriptionInfo.string;
if (returnDescription.length() > 0) {
jsdocBuilder.recordReturnDescription(returnDescription);
}
token=returnDescriptionInfo.token;
}
 else {
token=eatTokensUntilEOL(token);
}
continue retry;
case THIS:
if (!jsdocBuilder.recordThisType(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
break;
case TYPE:
if (!jsdocBuilder.recordType(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
break;
case TYPEDEF:
if (!jsdocBuilder.recordTypedef(type)) {
parser.addTypeWarning("String_Node_Str",lineno,charno);
}
break;
}
}
token=eatTokensUntilEOL();
continue retry;
}
}
}
break;
case EOC:
if (hasParsedFileOverviewDocInfo()) {
fileOverviewJSDocInfo=retrieveAndResetParsedJSDocInfo();
}
checkExtendedTypes(extendedTypes);
return true;
case EOF:
jsdocBuilder.build(null);
parser.addParserWarning("String_Node_Str",stream.getLineno(),stream.getCharno());
checkExtendedTypes(extendedTypes);
return false;
case EOL:
if (state == State.SEARCHING_NEWLINE) {
state=State.SEARCHING_ANNOTATION;
}
token=next();
continue retry;
default :
if (token == JsDocToken.STAR && state == State.SEARCHING_ANNOTATION) {
token=next();
continue retry;
}
 else {
state=State.SEARCHING_NEWLINE;
token=eatTokensUntilEOL();
continue retry;
}
}
token=next();
}
}