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) }; }
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);
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);