Rewrite sieve parser.
Three objectives: 1. Simplify code. 2. Produce optimized sieve code. 3. Improve error reporting. 4. Prepare for further extensions * include/mailutils/sieve.h (mu_sieve_tag_checker_t): Change signature (take mu_sieve_machine_t as the first arg). All uses changed. (mu_sieve_require): Likewise. (mu_sieve_yydebug): Remove global. * libmu_sieve/sieve-priv.h (mu_locus_range): New struct. (YYLTYPE): New define (mu_sieve_state): New enum. (mu_sieve_machine): New members: string_pool, state. (mu_sieve_node_type): New enum. (mu_sieve_node): New struct. Remove unused prototypes. * libmu_sieve/sieve.l: Keep track of code locations. Use opool for constructing string values. * libmu_sieve/sieve.y: Rewrite. First build the parse tree. Then optimize it. Finally, generate code. * libmu_sieve/tests.c (sieve_test_true,sieve_test_false): Remove. True and false tests are always optimized away. * libmu_sieve/util.c (mu_sv_compile_error): Remove. * libmu_sieve/actions.c: Use mu_diag_at_locus to report errors and mu_i_sv_error to mark sieve machine as being in error state. * libmu_sieve/comparator.c: Likewise. * libmu_sieve/prog.c (mu_sv_code): Replace with mu_i_sv_code. (mu_sv_code_instr,mu_sv_code_handler) (mu_sv_code_list,mu_sv_code_number) (mu_sv_code_string,mu_sv_code_source) (mu_sv_code_line,mu_sv_change_source) (mu_sv_code_action,mu_sv_code_test) (mu_sv_code_anyof,mu_sv_code_allof): Remove. (mu_i_sv_locus,mu_i_sv_code_action) (mu_i_sv_code_test): New function. (mu_sv_code_command): Replace with a static function. * libmu_sieve/require.c (mu_sieve_require): Take ptr to machine as the first arg. * libmu_sieve/runtime.c (mu_sieve_mailbox) (mu_sieve_message): Refuse to run if the machine is in error state. * sieve/sieve.c: Update. * sieve/tests/i-numeric.at: Update expected error message. * libmailutils/diag/diag.c (mu_diag_at_locus): Don't pass locus if mu_file is NULL. * libmu_auth/ldap.c (_mu_entry_to_auth_data): Remove leftover mu_error.
Showing
16 changed files
with
250 additions
and
204 deletions
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment