|| !isTypeChar(typeInfoString.charAt(end - 1)) || !isTypeChar(typeInfoString.charAt(end))) { Token t = new Token(); t.position = begin; t.text = typeInfoString.substring(begin, end);
|| !isTypeChar(typeInfoString.charAt(end - 1)) || !isTypeChar(typeInfoString.charAt(end))) { Token t = new Token(); t.position = begin; t.text = typeInfoString.substring(begin, end);
/** * Tokenize the typeInfoString. The rule is simple: all consecutive * alphadigits and '_', '.' are in one token, and all other characters are * one character per token. * * tokenize("map<int,string>") should return * ["map","<","int",",","string",">"] */ private static ArrayList<Token> tokenize(String typeInfoString) { ArrayList<Token> tokens = new ArrayList<Token>(0); int begin = 0; int end = 1; while (end <= typeInfoString.length()) { // last character ends a token? if (end == typeInfoString.length() || !isTypeChar(typeInfoString.charAt(end - 1)) || !isTypeChar(typeInfoString.charAt(end))) { Token t = new Token(); t.position = begin; t.text = typeInfoString.substring(begin, end); t.isType = isTypeChar(typeInfoString.charAt(begin)); tokens.add(t); begin = end; } end++; } return tokens; }
/** * Tokenize the typeInfoString. The rule is simple: all consecutive * alphadigits and '_', '.' are in one token, and all other characters are * one character per token. * * tokenize("map<int,string>") should return * ["map","<","int",",","string",">"] */ private static ArrayList<Token> tokenize(String typeInfoString) { ArrayList<Token> tokens = new ArrayList<Token>(0); int begin = 0; int end = 1; while (end <= typeInfoString.length()) { // last character ends a token? if (end == typeInfoString.length() || !isTypeChar(typeInfoString.charAt(end - 1)) || !isTypeChar(typeInfoString.charAt(end))) { Token t = new Token(); t.position = begin; t.text = typeInfoString.substring(begin, end); t.isType = isTypeChar(typeInfoString.charAt(begin)); tokens.add(t); begin = end; } end++; } return tokens; }
/** * Tokenize the typeInfoString. The rule is simple: all consecutive * alphadigits and '_', '.' are in one token, and all other characters are * one character per token. * * tokenize("map<int,string>") should return * ["map","<","int",",","string",">"] */ private static ArrayList<Token> tokenize(String typeInfoString) { ArrayList<Token> tokens = new ArrayList<Token>(0); int begin = 0; int end = 1; while (end <= typeInfoString.length()) { // last character ends a token? if (end == typeInfoString.length() || !isTypeChar(typeInfoString.charAt(end - 1)) || !isTypeChar(typeInfoString.charAt(end))) { Token t = new Token(); t.position = begin; t.text = typeInfoString.substring(begin, end); t.isType = isTypeChar(typeInfoString.charAt(begin)); tokens.add(t); begin = end; } end++; } return tokens; }