MCPcopy Create free account
hub / github.com/SquirrelJME/SquirrelJME / main

Method main

utils-dev/test/JavaIdentifier.java:27–74  ·  view source on GitHub ↗

Main entry point. @param __args Program arguments. @since 2017/09/09

(String... __args)

Source from the content-addressed store, hash-verified

25 * @since 2017/09/09
26 */
27 public static void main(String... __args)
28 {
29 int firstvalid = 0;
30 boolean wasvalid = false;
31 for (int i = 0; i <= 65536; i++)
32 {
33 // Zero is never valid
34 if (i == 0)
35 continue;
36
37 // Is it valid?
38 char c = (char)i;
39 boolean nowvalid = (i <= 65535 &&
40 !Character.isJavaIdentifierPart(c) &&
41 Character.isJavaIdentifierStart(c));
42
43 // Validity switch?
44 if (nowvalid != wasvalid)
45 {
46 // Is valid now, set mark here to determine how wide this
47 // range is
48 if (nowvalid)
49 firstvalid = i;
50
51 // Is invalid now
52 else
53 {
54 // Calculate the range of validity
55 int range = i - firstvalid;
56
57 // Single range, single check
58 if (range == 1)
59 System.out.printf("__c == 0x%04X ||%n", firstvalid);
60
61 // Long range
62 else
63 System.out.printf(
64 "(__c >= 0x%04X && __c < 0x%04X) ||%n",
65 firstvalid, i);
66 }
67 }
68
69 // Set
70 wasvalid = nowvalid;
71
72 }
73 System.out.println();
74 }
75}
76

Callers

nothing calls this directly

Calls 2

printfMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected