diff options
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r-- | lib/js/urweb.js | 118 |
1 files changed, 114 insertions, 4 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index f41d7240..19f708ca 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -27,8 +27,8 @@ function le(x, y) { return x <= y; } // Characters -function isLower(c) { return c.toLowerCase() == c && c != c.toUpperCase(); } -function isUpper(c) { return c.toUpperCase() == c && c != c.toLowerCase(); } +function isLower(c) { return toLower(c) == c && c != toUpper(c); } +function isUpper(c) { return toUpper(c) == c && c != toLower(c); } function isAlpha(c) { return isLower(c) || isUpper(c); } function isDigit(c) { return c >= '0' && c <= '9'; } function isAlnum(c) { return isAlpha(c) || isDigit(c); } @@ -37,9 +37,119 @@ function isSpace(c) { return isBlank(c) || c == '\r' || c == '\n'; } function isXdigit(c) { return isDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } function ord(c) { return c.codePointAt(0); } function isPrint(c) { return ord(c) > 31 && ord(c) != 127; } -function toLower(c) { return c.toLowerCase(); } + +function toLower(c) { + var cp = ord(c); + if (cp == 304) + return chr(105); + else if (cp >= 7312 && cp <= 7354) + return c; + else if (cp >= 7357 && cp <= 7359) + return c; + else if (cp == 42936) + return c; + else if (cp >= 93760 && cp <= 93791) + return c; + return c.toLowerCase(); +} + function toUpper(c) { - if (ord(c) == 223) + var cp = ord(c); + if (cp == 223) + return c; + else if (cp == 329) + return c; + else if (cp == 496) + return c; + else if (cp == 912) + return c; + else if (cp == 944) + return c; + else if (cp == 1415) + return c; + else if (cp >= 4304 && cp <= 4346) + return c; + else if (cp >= 4349 && cp <= 4351) + return c; + else if (cp >= 7830 && cp <= 7834) + return c; + else if (cp == 8016) + return c; + else if (cp == 8018) + return c; + else if (cp == 8020) + return c; + else if (cp == 8022) + return c; + else if (cp >= 8064 && cp <= 8071) + return chr(cp + 8) + else if (cp >= 8072 && cp <= 8079) + return c; + else if (cp >= 8080 && cp <= 8087) + return chr(cp + 8); + else if (cp >= 8088 && cp <= 8095) + return c; + else if (cp >= 8096 && cp <= 8103) + return chr(cp + 8) + else if (cp >= 8104 && cp <= 8111) + return c; + else if (cp == 8114) + return c; + else if (cp == 8115) + return chr(8124); + else if (cp == 8116) + return c; + else if (cp == 8118) + return c; + else if (cp == 8119) + return c; + else if (cp == 8124) + return c; + else if (cp == 8130) + return c; + else if (cp == 8131) + return chr(8140); + else if (cp == 8132) + return c; + else if (cp == 8134) + return c; + else if (cp == 8135) + return c; + else if (cp == 8140) + return c; + else if (cp == 8146) + return c; + else if (cp == 8147) + return c; + else if (cp == 8150) + return c; + else if (cp == 8151) + return c; + else if (cp >= 8162 && cp <= 8164) + return c; + else if (cp == 8166) + return c; + else if (cp == 8167) + return c; + else if (cp == 8178) + return c; + else if (cp == 8179) + return chr(8188); + else if (cp == 8180) + return c; + else if (cp == 8182) + return c; + else if (cp == 8183) + return c; + else if (cp == 8188) + return c; + else if (cp == 42937) + return c; + else if (cp >= 64256 && cp <= 64262) + return c; + else if (cp >= 64275 && cp <= 64279) + return c; + else if (cp >= 93792 && cp <= 93823) return c; else return c.toUpperCase(); |