t = F.at(pos).Literal( TypeTag.INT, Convert.string2int(strval(prefix), token.radix())); } catch (NumberFormatException ex) { error(token.pos, "int.number.too.large", strval(prefix)); t = F.at(pos).Literal( TypeTag.LONG, new Long(Convert.string2long(strval(prefix), token.radix()))); } catch (NumberFormatException ex) { error(token.pos, "int.number.too.large", strval(prefix)); String proper = token.radix() == 16 ? ("0x"+ token.stringVal()) : token.stringVal(); Float n; try { String proper = token.radix() == 16 ? ("0x"+ token.stringVal()) : token.stringVal(); Double n; try { t = F.at(pos).Literal( TypeTag.CHAR, token.stringVal().charAt(0) + 0); break; case STRINGLITERAL:
Token[] split(Tokens tokens) { if (kind.name.length() < 2 || kind.tag != Tag.DEFAULT) { throw new AssertionError("Cant split" + kind); } TokenKind t1 = tokens.lookupKind(kind.name.substring(0, 1)); TokenKind t2 = tokens.lookupKind(kind.name.substring(1)); if (t1 == null || t2 == null) { throw new AssertionError("Cant split - bad subtokens"); } return new Token[] { new Token(t1, pos, pos + t1.name.length(), comments), new Token(t2, pos + t1.name.length(), endPos, null) }; }
case DEFAULT: return new Token(tk, pos, endPos, comments); case NAMED: return new NamedToken(tk, pos, endPos, name, comments); case STRING: return new StringToken(tk, pos, endPos, reader.chars(), comments);
if (tk == SUB && (token.kind == INTLITERAL || token.kind == LONGLITERAL) && token.radix() == 10) { mode = EXPR; t = literal(names.hyphen, pos);
case DEFAULT: return new Token(tk, pos, endPos, comments); case NAMED: return new NamedToken(tk, pos, endPos, name, comments); case STRING: return new StringToken(tk, pos, endPos, reader.chars(), comments);
if (tk == SUB && (token.kind == INTLITERAL || token.kind == LONGLITERAL) && token.radix() == 10) { mode = EXPR; t = literal(names.hyphen, pos);
nextToken(); JCStatement stat = parseStatement(); return F.at(pos).Labelled(prevToken.name(), stat); } else {
nextToken(); JCStatement stat = parseStatement(); return F.at(pos).Labelled(prevToken.name(), stat); } else {
t = F.at(pos).Literal( TypeTag.INT, Convert.string2int(strval(prefix), token.radix())); } catch (NumberFormatException ex) { error(token.pos, "int.number.too.large", strval(prefix)); t = F.at(pos).Literal( TypeTag.LONG, new Long(Convert.string2long(strval(prefix), token.radix()))); } catch (NumberFormatException ex) { error(token.pos, "int.number.too.large", strval(prefix)); String proper = token.radix() == 16 ? ("0x"+ token.stringVal()) : token.stringVal(); Float n; try { String proper = token.radix() == 16 ? ("0x"+ token.stringVal()) : token.stringVal(); Double n; try { t = F.at(pos).Literal( TypeTag.CHAR, token.stringVal().charAt(0) + 0); break; case STRINGLITERAL:
defs.append(importDeclaration()); } else { Comment docComment = token.comment(CommentStyle.JAVADOC); if (firstTypeDecl && !seenImport && !seenPackage) { docComment = firstToken.comment(CommentStyle.JAVADOC); consumedToplevelDoc = true; attach(toplevel, firstToken.comment(CommentStyle.JAVADOC)); if (defs.isEmpty()) storeEnd(toplevel, S.prevToken().endPos);
case MONKEYS_AT: case FINAL: { Comment dc = token.comment(CommentStyle.JAVADOC); JCModifiers mods = modifiersOpt(); if (token.kind == INTERFACE || Comment dc = token.comment(CommentStyle.JAVADOC); JCModifiers mods = modifiersOpt(); return List.of(classOrInterfaceOrEnumDeclaration(mods, dc)); Comment dc = token.comment(CommentStyle.JAVADOC); return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc)); case ENUM: if (allowEnums && token.kind == ENUM) { error(token.pos, "local.enum"); dc = token.comment(CommentStyle.JAVADOC); return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc)); } else if (allowAsserts && token.kind == ASSERT) { nextToken(); JCStatement stat = parseStatement(); return List.<JCStatement>of(F.at(pos).Labelled(prevToken.name(), stat)); } else if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) { pos = token.pos;
Name name = token.name(); nextToken(); return name; } else { warning(token.pos, "assert.as.identifier"); Name name = token.name(); nextToken(); return name; } else { warning(token.pos, "enum.as.identifier"); Name name = token.name(); nextToken(); return name; Name name = token.name(); nextToken(); return name; Name name = token.name(); nextToken(); return name;
case MONKEYS_AT: case FINAL: { Comment dc = token.comment(CommentStyle.JAVADOC); JCModifiers mods = modifiersOpt(); if (token.kind == INTERFACE || Comment dc = token.comment(CommentStyle.JAVADOC); JCModifiers mods = modifiersOpt(); return List.of(classOrInterfaceOrEnumDeclaration(mods, dc)); Comment dc = token.comment(CommentStyle.JAVADOC); return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc)); case ENUM: if (allowEnums && token.kind == ENUM) { error(token.pos, "local.enum"); dc = token.comment(CommentStyle.JAVADOC); return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc)); } else if (allowAsserts && token.kind == ASSERT) { nextToken(); JCStatement stat = parseStatement(); return List.<JCStatement>of(F.at(pos).Labelled(prevToken.name(), stat)); } else if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) { pos = token.pos;
defs.append(importDeclaration()); } else { Comment docComment = token.comment(CommentStyle.JAVADOC); if (firstTypeDecl && !seenImport && !seenPackage) { docComment = firstToken.comment(CommentStyle.JAVADOC); consumedToplevelDoc = true; attach(toplevel, firstToken.comment(CommentStyle.JAVADOC)); if (defs.isEmpty()) storeEnd(toplevel, S.prevToken().endPos);
pos = partial.pos; if (token.deprecatedFlag()) { flags |= Flags.DEPRECATED;
pos = partial.pos; if (token.deprecatedFlag()) { flags |= Flags.DEPRECATED;
Name name = token.name(); nextToken(); return name; } else { warning(token.pos, "assert.as.identifier"); Name name = token.name(); nextToken(); return name; } else { warning(token.pos, "enum.as.identifier"); Name name = token.name(); nextToken(); return name; Name name = token.name(); nextToken(); return name; Name name = token.name(); nextToken(); return name;
if (lambdaParameter && token.kind == UNDERSCORE) { log.error(pos, "underscore.as.identifier.in.lambda"); name = token.name(); nextToken(); } else {