summaryrefslogtreecommitdiffstats
path: root/ChangeLog
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-10-26 13:23:38 -0400
committerKaz Kylheku <kaz@kylheku.com>2011-10-26 13:23:38 -0400
commitad46d49574ea8ada67d8644c70817502c8591305 (patch)
treefc069f9eefe2edda87733f24937cc4103d7d414d /ChangeLog
parentdabff9ab6f89a1ec36461022a811c1f10cd09f17 (diff)
downloadtxr-ad46d49574ea8ada67d8644c70817502c8591305.tar.gz
txr-ad46d49574ea8ada67d8644c70817502c8591305.tar.bz2
txr-ad46d49574ea8ada67d8644c70817502c8591305.zip
Parse error handling improvements.
* parser.l (prepared_error_message): New static variable. (yyerror): Emit and clear prepared error message. (yyerrprepf): New static function. (yybadtoken): Function moved into parser.y. (grammar): For irrecoverable lexical errors, stash error message with yyerrprepf and return the special error token ERRTOK to generate a syntax error. I could find no other interface to the parser to make it cleanly exit. * parser.y (ERRTOK): New terminal symbol, does not appear anywhere in the grammar. (spec): Bail after 8 errors, recover to nearest newline, and use yyerrok to clear error situation. (YYEOF): Provided by Bison, conditionally defined for other yacc-s. (yybadtoken): Function moved from parser.l. Checks for the next token being YYEMPTY or YYEOF, and also handles ERRTOK. * stream.c (vformat_to_string): New function. (format): If stream is nil, format to string and return it. * stream.h (vformat_to_string): Declared.
Diffstat (limited to 'ChangeLog')
-rw-r--r--ChangeLog26
1 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 36f9205d..bdb76184 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
2011-10-26 Kaz Kylheku <kaz@kylheku.com>
+ Parse error handling improvements.
+
+ * parser.l (prepared_error_message): New static variable.
+ (yyerror): Emit and clear prepared error message.
+ (yyerrprepf): New static function.
+ (yybadtoken): Function moved into parser.y.
+ (grammar): For irrecoverable lexical errors, stash error message
+ with yyerrprepf and return the special error token ERRTOK to generate a
+ syntax error. I could find no other interface to the parser to make it
+ cleanly exit.
+
+ * parser.y (ERRTOK): New terminal symbol, does not appear anywhere
+ in the grammar.
+ (spec): Bail after 8 errors, recover to nearest newline, and
+ use yyerrok to clear error situation.
+ (YYEOF): Provided by Bison, conditionally defined for other yacc-s.
+ (yybadtoken): Function moved from parser.l. Checks for the next
+ token being YYEMPTY or YYEOF, and also handles ERRTOK.
+
+ * stream.c (vformat_to_string): New function.
+ (format): If stream is nil, format to string and return it.
+
+ * stream.h (vformat_to_string): Declared.
+
+2011-10-26 Kaz Kylheku <kaz@kylheku.com>
+
* match.c (v_cat): Bugfix: unterminated variable argument list.
* tests/001/query-3.txr: Updated to new cat syntax.