--- a/parser.c Mon Jul 24 16:38:12 2000 +0200 +++ b/parser.c Sun Aug 27 21:21:29 2000 +0200 @@ -27,12 +27,9 @@ }; -static bool check_args(const Tokenizer *tokz, Token *tokens, int ntokens, - const char *fmt); +/* */ -/* */ - static bool opt_include(Tokenizer *tokz, int n, Token *toks); @@ -339,21 +336,25 @@ break; case P_END_SECT: - if(errornest!=0){ - errornest--; - break; - } - if(tokz->nest_lvl==0){ tokz_warn_error(tokz, tokz->line, E_TOKZ_SYNTAX); had_error=TRUE; break; } - if(!had_error) - had_error=!call_end_sect(tokz, tokz->optstack[tokz->nest_lvl]); + if(errornest!=0){ + if(errornest==1){ + call_cancel_sect(tokz, tokz->optstack[tokz->nest_lvl]); + tokz->nest_lvl--; + } + errornest--; + }else{ + if(!had_error) + had_error=!call_end_sect(tokz, + tokz->optstack[tokz->nest_lvl]); - tokz->nest_lvl--; + tokz->nest_lvl--; + } if(tokz->nest_lvl<init_nest_lvl) goto eof; @@ -362,8 +363,11 @@ if(!had_error) continue; - if(t==P_STMT_SECT) + if(t==P_STMT_SECT || t==P_END_SECT){ errornest++; + /*if(t==P_END_SECT) + tokz->nest_lvl--;*/ + } if(!(tokz->flags&TOKZ_ERROR_TOLERANT)) break; @@ -446,14 +450,11 @@ static int arg_match(Token *tok, char c) { - static const char chs[]={0, 'l', 'd', 'c', 's', 'i', 'b', 0, 0}; - char c2; + char c2=tok->type; if(c=='.' || c=='*') return 0; - c2=chs[tok->type]; - if(c2==c) return 0; @@ -567,8 +568,8 @@ } -static bool check_args(const Tokenizer *tokz, Token *tokens, int ntokens, - const char *fmt) +bool check_args(const Tokenizer *tokz, Token *tokens, int ntokens, + const char *fmt) { int i; int e;