Lexer { public static PossibleSymbolTypes determine_possible_symbol_types_for_string(String s) { PossibleSymbolTypes p = new PossibleSymbolTypes(); if (s.length() == 0) { return p; } if (Lexer.number_starters[s.charAt(0)]) { int ch = 0; if ((s.charAt(ch)=='+')||(s.charAt(ch)=='-')) ch++; while (ch < s.length() && Character.isDigit(s.charAt(ch))) ch++; if (ch == s.length() && Character.isDigit(s.charAt(ch-1))) p.possible_ic = true; if (ch < s.length() && s.charAt(ch)=='.') { ch++; while (ch < s.length() && Character.isDigit(s.charAt(ch))) ch++; if (ch < s.length() && (s.charAt(ch)=='e' || s.charAt(ch)=='E')) { ch++; if (ch < s.length() && (s.charAt(ch)=='+' || s.charAt(ch)=='-')) ch++; while (ch < s.length() && Character.isDigit(s.charAt(ch))) ch++; } if (ch==s.length()) p.possible_fc = true; } } boolean all_alphanum = true; for (int i = 0; i < s.length(); ++i) { final char c = s.charAt(i); if (!isConstituentChar(c)) { return p; } all_alphanum = all_alphanum && Character.isLetterOrDigit(c); } if ( all_alphanum || (s.length() > LENGTH_OF_LONGEST_SPECIAL_LEXEME) || ((s.length()==1)&&(s.charAt(0)=='*')) ) { p.rereadable = true; } p.possible_sc = true; if ((s.charAt(0) == '<') && (s.charAt(s.length() - 1) == '>')) { p.possible_var = true; } final int idStartIndex = s.charAt(0) == '@' ? 1 : 0; final char idStart = s.charAt(idStartIndex); if (s.length() > 1 && Character.isLetter(idStart)) { int i = idStartIndex + 1; while (i < s.length() && Character.isDigit(s.charAt(i))) { ++i; } p.possible_id = i == s.length(); } return p; } Lexer(Printer printer, Reader reader); Lexeme getCurrentLexeme(); boolean isEof(); void setLexemeType(LexemeType type); void getNextLexeme(); void setAllowIds(boolean allow_identifiers); boolean isAllowIds(); static PossibleSymbolTypes determine_possible_symbol_types_for_string(String s); void get_lexeme_from_string(String the_lexeme);  }
@Test public void testThatAnOutOfBoundsIntegerIsStillAPossibleInteger() { final PossibleSymbolTypes pst = Lexer.determine_possible_symbol_types_for_string("5000000000"); assertNotNull(pst); assertTrue(pst.possible_ic); }