Changeset 15414


Ignore:
Timestamp:
10/14/20 07:07:24 (3 years ago)
Author:
Mark Evenson
Message:

pathname: change parsing of type

Change the algorithim for determining type from parsing strings to be
more in line with SBCL/CCL:

| Expression | NAME | TYPE |

+--------+------|

| #p"..." | ".." | "" |
| #p".foo" | ".foo" | NIL |

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Pathname.java

    r15413 r15414  
    392392    }
    393393
    394     if (s.startsWith(".")
    395         // No TYPE can be parsed
    396         && (s.indexOf(".", 1) == -1
    397             || s.substring(s.length() -1).equals("."))) {
    398       result.setName(new SimpleString(s));
    399       return result;
    400     }
    401 
    402394    int index = s.lastIndexOf('.');
    403     String n = null;
    404     String t = null;
     395    String name = null;
     396    String type = null;
    405397    if (index > 0) {
    406       n = s.substring(0, index);
    407       t = s.substring(index + 1);
     398      name = s.substring(0, index);
     399      type = s.substring(index + 1);
    408400    } else if (s.length() > 0) {
    409       n = s;
    410     }
    411     if (n != null) {
    412       if (n.equals("*")) {
     401      name = s;
     402    }
     403    if (name != null) {
     404      if (name.equals("*")) {
    413405        result.setName(Keyword.WILD);
    414406      } else {
    415         result.setName(new SimpleString(n));
    416       }
    417         }
    418     if (t != null) {
    419       if (t.equals("*")) {
     407        result.setName(new SimpleString(name));
     408      }
     409    }
     410    if (type != null) {
     411      if (type.equals("*")) {
    420412        result.setType(Keyword.WILD);
    421413      } else {
    422         result.setType(new SimpleString(t));
     414        result.setType(new SimpleString(type));
    423415      }
    424416    }
Note: See TracChangeset for help on using the changeset viewer.