aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-12-08 10:46:50 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-12-08 10:46:50 -0500
commit778b73af8cd74791c5d2f8cc520d82e3b4e1f5de (patch)
tree7a41d068fbf90d72aa9a1aea897a2143c247f276 /lib/js
parentc1d821782a8d7948c52d01863508eabe42bd89e9 (diff)
Context globals; ctype functions
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 863271d9..15c9df7e 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -23,6 +23,20 @@ function mod(x, y) { return x % y; }
function lt(x, y) { return x < y; }
function le(x, y) { return x <= y; }
+// Characters
+
+function isLower(c) { return c >= 'a' && c <= 'z'; }
+function isUpper(c) { return c >= 'A' && c <= 'Z'; }
+function isAlpha(c) { return isLower(c) || isUpper(c); }
+function isDigit(c) { return c >= '0' && c <= '9'; }
+function isAlnum(c) { return isAlpha(c) || isDigit(c); }
+function isBlank(c) { return c == ' ' || c == '\t'; }
+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 toLower(c) { return c.toLowercase(); }
+function toUpper(c) { return c.toUppercase(); }
+
+
// Lists
function cons(v, ls) {