diff lib/js/urweb.js @ 1061:e8a35d710ab9

Context globals; ctype functions
author Adam Chlipala <adamc@hcoop.net>
date Tue, 08 Dec 2009 10:46:50 -0500
parents eaba663fd6aa
children e81434513720
line wrap: on
line diff
--- a/lib/js/urweb.js	Tue Dec 08 09:33:08 2009 -0500
+++ b/lib/js/urweb.js	Tue Dec 08 10:46:50 2009 -0500
@@ -23,6 +23,20 @@
 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) {