diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-12-15 00:17:39 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-12-15 00:17:39 -0800 |
commit | 030ce483baef93392d54a4aec90bfa7b5906bc53 (patch) | |
tree | 434c2981465d9c8fd3d84b5d9d8207a2beeddd67 /lib.c | |
parent | e5cd9bbd3de84e90d5602b83a0eb7780ec4b750e (diff) | |
download | txr-030ce483baef93392d54a4aec90bfa7b5906bc53.tar.gz txr-030ce483baef93392d54a4aec90bfa7b5906bc53.tar.bz2 txr-030ce483baef93392d54a4aec90bfa7b5906bc53.zip |
Changing the tokenizer to get rid of IDENT, KEYWORD and METAVAR
token categories, replaced by a single one called SYMTOK.
Package prefixes are now recognized and processed in tokens.
* lib.c (delete_package): Fix problem in no-such-package
error case: it would always report nil as the name.
(intern): Fix nonsensical error message: in the no-such-package case it
would report that the symbol exists already.
* parser.l (grammar): Occurences of KEYWORD, METAVAR, and IDENT
scrubbed. All rules reporting any of these now return
SYMTOK. The main one of these is greatly simplified.
* parser.y (sym_helper): New function.
(char_from_name): const qualifier inside param's type declaration.
(grammar): IDENT, KEYWORD and METAVAR tokens are gone.
New token SYMTOK. Grammar refactored around SYMTOK and using
the new sym_helper function.
(char_from_name): Updated.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -2542,9 +2542,10 @@ val find_package(val name) val delete_package(val package) { if (stringp(package)) { - package = find_package(package); - if (!package) + val p = find_package(package); + if (!p) uw_throwf(error_s, lit("delete-package: no such package: ~s"), package, nao); + package = p; } type_check (package, PKG); @@ -2562,7 +2563,7 @@ val intern(val str, val package) } else if (stringp(package)) { package = find_package(str); if (!package) - uw_throwf(error_s, lit("intern: symbol ~s exists already"), str, nao); + uw_throwf(error_s, lit("intern: ~s no such package"), str, nao); } type_check (package, PKG); |