[armedbear-cvs] r13256 - trunk/abcl/src/org/armedbear/lisp

Mark Evenson mevenson at common-lisp.net
Mon Mar 21 06:25:00 UTC 2011


Author: mevenson
Date: Mon Mar 21 02:24:58 2011
New Revision: 13256

Log:
The sharpsign backslash macro now understands \unnnn as an escape for a Unicode chararcter.

Modified:
   trunk/abcl/src/org/armedbear/lisp/LispCharacter.java

Modified: trunk/abcl/src/org/armedbear/lisp/LispCharacter.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispCharacter.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/LispCharacter.java	Mon Mar 21 02:24:58 2011
@@ -553,6 +553,14 @@
     String lower = s.toLowerCase();
     LispCharacter lc = namedToChar.get(lower);
     if (lc!=null) return lc.value;
+    if (lower.length() == 5
+        && lower.startsWith("u")) {
+        try {
+            int i = Integer.parseInt(lower.substring(1, 5), 16);
+            return i;
+        } catch (NumberFormatException e) {};
+    }
+
     if (lower.equals("null"))
       return 0;
     if (lower.equals("bell"))
@@ -617,7 +625,12 @@
       case 127:
         return "Rubout";
       }
-    if (c<0 || c>255) return null;
+
+    if (c > 255) {
+        return "U" + Integer.toString(c, 16);
+    }
+        
+    if (c<0) return null;
     return lispChars.get(c).name;
   }
 




More information about the armedbear-cvs mailing list