Changeset 13706
- Timestamp:
- 12/20/11 21:52:14 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Stream.java
r13598 r13706 1031 1031 return NIL; 1032 1032 final LispObject readtableCase = rt.getReadtableCase(); 1033 final String token; 1034 if (readtableCase == Keyword.INVERT) 1035 token = invert(sb.toString(), flags); 1036 else 1037 token = sb.toString(); 1033 final String token = sb.toString(); 1034 final boolean invert = readtableCase == Keyword.INVERT; 1038 1035 final int length = token.length(); 1039 1036 if (length > 0) { … … 1074 1071 } 1075 1072 } 1076 if (firstChar == ':') 1077 if (flags == null || !flags.get(0)) 1078 return PACKAGE_KEYWORD.intern(token.substring(1)); 1079 int index = findUnescapedDoubleColon(token, flags); 1080 if (index > 0) { 1081 String packageName = token.substring(0, index); 1082 String symbolName = token.substring(index + 2); 1083 Package pkg = Packages.findPackage(packageName); 1073 1074 String symbolName; 1075 String packageName = null; 1076 BitSet symbolFlags; 1077 BitSet packageFlags = null; 1078 Package pkg = null; 1079 boolean internSymbol = true; 1080 if (firstChar == ':' && (flags == null || !flags.get(0))) { 1081 symbolName = token.substring(1); 1082 pkg = PACKAGE_KEYWORD; 1083 if (flags != null) 1084 symbolFlags = flags.get(1, flags.size()); 1085 else 1086 symbolFlags = null; 1087 } else { 1088 int index = findUnescapedDoubleColon(token, flags); 1089 if (index > 0) { 1090 packageName = token.substring(0, index); 1091 packageFlags = (flags != null) ? flags.get(0, index) : null; 1092 symbolName = token.substring(index + 2); 1093 symbolFlags = (flags != null) ? flags.get(index+2, flags.size()) : null; 1094 } else { 1095 index = findUnescapedSingleColon(token, flags); 1096 if (index > 0) { 1097 packageName = token.substring(0, index); 1098 packageFlags = (flags != null) ? flags.get(0, index) : null; 1099 symbolName = token.substring(index + 1); 1100 symbolFlags = (flags != null) ? flags.get(index+2, flags.size()) : null; 1101 internSymbol = false; 1102 } else { 1103 pkg = (Package)Symbol._PACKAGE_.symbolValue(thread); 1104 symbolName = token; 1105 symbolFlags = flags; 1106 } 1107 } 1108 } 1109 if (pkg == null) { 1110 if (invert) 1111 packageName = invert(packageName, packageFlags); 1112 1113 pkg = Packages.findPackage(packageName); 1084 1114 if (pkg == null) 1085 return error(new LispError("Package \"" + packageName + 1086 "\" not found.")); 1115 return error(new ReaderError("The package \"" + packageName + "\" can't be found.", this)); 1116 } 1117 if (invert) 1118 symbolName = invert(symbolName, symbolFlags); 1119 1120 if (internSymbol) { 1087 1121 return pkg.intern(symbolName); 1088 } 1089 index = findUnescapedSingleColon(token, flags); 1090 if (index > 0) { 1091 final String packageName = token.substring(0, index); 1092 Package pkg = Packages.findPackage(packageName); 1093 if (pkg == null) 1094 return error(new PackageError("Package \"" + packageName + 1095 "\" not found.")); 1096 final String symbolName = token.substring(index + 1); 1097 final SimpleString s = new SimpleString(symbolName); 1098 Symbol symbol = pkg.findExternalSymbol(s); 1122 } else { 1123 Symbol symbol = pkg.findExternalSymbol(symbolName); 1099 1124 if (symbol != null) 1100 1125 return symbol; 1126 1101 1127 // Error! 1102 if (pkg.findInternalSymbol(s ) != null)1128 if (pkg.findInternalSymbol(symbolName) != null) 1103 1129 return error(new ReaderError("The symbol \"" + symbolName + 1104 1130 "\" is not external in package " + … … 1112 1138 } 1113 1139 } 1114 // Intern token in current package. 1115 return ((Package)Symbol._PACKAGE_.symbolValue(thread)).intern(new SimpleString(token)); 1140 return error(new ReaderError("Can't intern zero-length symbol.", this)); 1116 1141 } 1117 1142
Note: See TracChangeset
for help on using the changeset viewer.