From 030ce483baef93392d54a4aec90bfa7b5906bc53 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 15 Dec 2013 00:17:39 -0800 Subject: 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. --- lib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index 245c864f..e95d72f8 100644 --- a/lib.c +++ b/lib.c @@ -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); -- cgit v1.2.3