Checks if a string is a simple atom, with no quoting needed @param s string to check if it is simple name (no quoting needed) @return whether s is a simple name, i.e. which needs no quoting in source text
(String s)
| 291 | * @return whether s is a simple name, i.e. which needs no quoting in source text |
| 292 | */ |
| 293 | protected static boolean isSimpleName(String s) { |
| 294 | int len; |
| 295 | char c; |
| 296 | if (s == null) { |
| 297 | throw new java.lang.NullPointerException(); // JPL won't call it this way |
| 298 | } else if ((len = s.length()) == 0) { |
| 299 | return false; |
| 300 | } else if ((c = s.charAt(0)) < 'a' || c > 'z') { |
| 301 | return false; |
| 302 | } else { |
| 303 | for (int i = 1; i < len; i++) { |
| 304 | c = s.charAt(i); |
| 305 | if (!(c == '_' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || c >= '0' && c <= '9')) { |
| 306 | return false; |
| 307 | } |
| 308 | } |
| 309 | return true; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | // /** |
| 314 | // * whether the String arg is a plausible tag, e.g. "J#0123456789". |
no outgoing calls
no test coverage detected