Returns the token type for the specified symbol or keyword text. Returns #UNKNOWN if the text is not found. Optionally filters the result by type (e.g., restrict to keywords only). @param text the text to look up (e.g., "def", "+", "if") @param filter a type filter (#KEYWORD, {@link
(String text, int filter)
| 1297 | * @return the token type, or {@link #UNKNOWN} if not found or doesn't match the filter |
| 1298 | */ |
| 1299 | public static int lookup(String text, int filter) { |
| 1300 | int type = UNKNOWN; |
| 1301 | |
| 1302 | if (LOOKUP.containsKey(text)) { |
| 1303 | type = LOOKUP.get(text); |
| 1304 | if (filter != UNKNOWN && !ofType(type, filter)) { |
| 1305 | type = UNKNOWN; |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | return type; |
| 1310 | } |
| 1311 | |
| 1312 | |
| 1313 | /** |
no test coverage detected