projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3527013
)
lexer: Support more options in lex_error_expecting_array().
author
Ben Pfaff
<blp@cs.stanford.edu>
Mon, 1 Aug 2022 04:16:24 +0000
(21:16 -0700)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sun, 28 Aug 2022 21:22:19 +0000
(14:22 -0700)
src/language/lexer/lexer.c
patch
|
blob
|
history
diff --git
a/src/language/lexer/lexer.c
b/src/language/lexer/lexer.c
index 1fadf53b3079e9758bc4e13a5fc8bc36f1d0a046..eb5d7cbd37ae32a03bf11f923467583a20174d01 100644
(file)
--- a/
src/language/lexer/lexer.c
+++ b/
src/language/lexer/lexer.c
@@
-531,7
+531,19
@@
lex_error_expecting_array (struct lexer *lexer, const char **options, size_t n)
break;
default:
- lex_error (lexer, NULL);
+ {
+ struct string s = DS_EMPTY_INITIALIZER;
+ for (size_t i = 0; i < n; i++)
+ {
+ if (i > 0)
+ ds_put_cstr (&s, ", ");
+ ds_put_cstr (&s, options[i]);
+ }
+ lex_error (lexer, _("expecting one of the following: %s"),
+ ds_cstr (&s));
+ ds_destroy (&s);
+ }
+ break;
}
}