Changeset 14175


Ignore:
Timestamp:
10/10/12 14:17:11 (8 years ago)
Author:
Mark Evenson
Message:

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

Location:
trunk/abcl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/doc/manual/abcl.tex

    r13933 r14175  
    980980\section{Extensions to the Reader}
    981981
    982 We implement a special hexadecimal escape sequence for specifying
    983 characters to the Lisp reader, namely we allow a sequences of the form
    984 \# \textbackslash Uxxxx to be processed by the reader as character
    985 whose code is specified by the hexadecimal digits ``xxxx''.  The
    986 hexadecimal sequence must be exactly four digits long \footnote{This
    987   represents a compromise with contemporary in 2011 32bit hosting
    988   architecures for which we wish to make text processing efficient.
    989   Should the User require more control over UNICODE processing we
    990   recommend Edi Weisz' excellent work with FLEXI-STREAMS which we
    991   fully support}, padded by leading zeros for values less than 0x1000.
     982We implement a special hexadecimal escape sequence for specifying 32
     983bit characters to the Lisp reader\footnote{This represents a
     984  compromise with contemporary in 2011 32bit hosting architecures for
     985  which we wish to make text processing efficient.  Should the User
     986  require more control over UNICODE processing we recommend Edi Weisz'
     987  excellent work with FLEXI-STREAMS which we fully support}, namely we
     988allow a sequences of the form \# \textbackslash Uxxxx to be processed
     989by the reader as character whose code is specified by the hexadecimal
     990digits ``xxxx''.  The hexadecimal sequence may be one to four digits
     991long.
    992992
    993993Note that this sequence is never output by the implementation.  Instead,
  • trunk/abcl/src/org/armedbear/lisp/LispCharacter.java

    r13765 r14175  
    557557        && lower.startsWith("u")) {
    558558        try {
    559             int i = Integer.parseInt(lower.substring(1, 5), 16);
     559            final int i = Integer.parseInt(lower.substring(1, 5), 16);
    560560            return i;
    561561        } catch (NumberFormatException e) {};
     
    586586    if (lower.equals("rubout"))
    587587      return 127;
     588    if (lower.startsWith("u")) {
     589      int length = lower.length();
     590      if (length > 1 && length < 5) {
     591        try {
     592          final int i = Integer.parseInt(lower.substring(1), 16);
     593          return i;
     594        } catch (NumberFormatException e) {};
     595        // fall through
     596      }
     597    }
     598
    588599    // Unknown.
    589600    return -1;
Note: See TracChangeset for help on using the changeset viewer.