[armedbear-cvs] r14175 - in trunk/abcl: doc/manual src/org/armedbear/lisp

mevenson at common-lisp.net mevenson at common-lisp.net
Wed Oct 10 14:17:14 UTC 2012


Author: mevenson
Date: Wed Oct 10 07:17:11 2012
New Revision: 14175

Log:
Reading a Lisp name for \uNNNN works for non-zero padded forms less than 0x1000.

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

Modified: trunk/abcl/doc/manual/abcl.tex
==============================================================================
--- trunk/abcl/doc/manual/abcl.tex	Mon Oct  8 22:09:53 2012	(r14174)
+++ trunk/abcl/doc/manual/abcl.tex	Wed Oct 10 07:17:11 2012	(r14175)
@@ -979,16 +979,16 @@
 
 \section{Extensions to the Reader}
 
-We implement a special hexadecimal escape sequence for specifying
-characters to the Lisp reader, namely we allow a sequences of the form
-\# \textbackslash Uxxxx to be processed by the reader as character
-whose code is specified by the hexadecimal digits ``xxxx''.  The
-hexadecimal sequence must be exactly four digits long \footnote{This
-  represents a compromise with contemporary in 2011 32bit hosting
-  architecures for which we wish to make text processing efficient.
-  Should the User require more control over UNICODE processing we
-  recommend Edi Weisz' excellent work with FLEXI-STREAMS which we
-  fully support}, padded by leading zeros for values less than 0x1000.
+We implement a special hexadecimal escape sequence for specifying 32
+bit characters to the Lisp reader\footnote{This represents a
+  compromise with contemporary in 2011 32bit hosting architecures for
+  which we wish to make text processing efficient.  Should the User
+  require more control over UNICODE processing we recommend Edi Weisz'
+  excellent work with FLEXI-STREAMS which we fully support}, namely we
+allow a sequences of the form \# \textbackslash Uxxxx to be processed
+by the reader as character whose code is specified by the hexadecimal
+digits ``xxxx''.  The hexadecimal sequence may be one to four digits
+long.
 
 Note that this sequence is never output by the implementation.  Instead,
 the corresponding Unicode character is output for characters whose

Modified: trunk/abcl/src/org/armedbear/lisp/LispCharacter.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispCharacter.java	Mon Oct  8 22:09:53 2012	(r14174)
+++ trunk/abcl/src/org/armedbear/lisp/LispCharacter.java	Wed Oct 10 07:17:11 2012	(r14175)
@@ -556,7 +556,7 @@
     if (lower.length() == 5
         && lower.startsWith("u")) {
         try {
-            int i = Integer.parseInt(lower.substring(1, 5), 16);
+            final int i = Integer.parseInt(lower.substring(1, 5), 16);
             return i;
         } catch (NumberFormatException e) {};
     }
@@ -585,6 +585,17 @@
       return ' ';
     if (lower.equals("rubout"))
       return 127;
+    if (lower.startsWith("u")) {
+      int length = lower.length();
+      if (length > 1 && length < 5) {
+        try {
+          final int i = Integer.parseInt(lower.substring(1), 16);
+          return i;
+        } catch (NumberFormatException e) {};
+        // fall through
+      }
+    }
+
     // Unknown.
     return -1;
   }




More information about the armedbear-cvs mailing list