From f3129a3cc4800321ed2157eb400da8b43398606e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 4 Feb 2014 08:09:27 +0000 Subject: parser: recover from errors in any block Move error recovery to the common_block definition to handle errors in any block. Queue those errors and abort parsing once a threshold is reached. With this in place, we can continue parsing when errors occur and show all of them to the user at once. tests/error.1:3:8-8: Error: syntax error, unexpected '{', expecting string filter { ^ tests/error.1:4:13-13: Error: syntax error, unexpected newline filter input ^ tests/error.1:5:17-17: Error: syntax error, unexpected newline filter input tcp ^ tests/error.1:6:23-23: Error: syntax error, unexpected newline filter input tcp dport Signed-off-by: Patrick McHardy --- include/nftables.h | 1 + include/parser.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/include/nftables.h b/include/nftables.h index 5a000870..7f3968d4 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -24,6 +24,7 @@ enum debug_level { #define INCLUDE_PATHS_MAX 16 +extern unsigned int max_errors; extern unsigned int numeric_output; extern unsigned int handle_output; extern unsigned int debug_level; diff --git a/include/parser.h b/include/parser.h index f5dd6f4b..7a1c2dbe 100644 --- a/include/parser.h +++ b/include/parser.h @@ -19,6 +19,7 @@ struct parser_state { unsigned int indesc_idx; struct list_head *msgs; + unsigned int nerrs; struct scope top_scope; struct scope *scopes[SCOPE_NEST_MAX]; -- cgit v1.2.3