summaryrefslogtreecommitdiff
path: root/libsieve/sieve.y
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-04-07 09:14:32 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-04-07 09:14:32 +0000
commita6a6d420ed2e8f4924d25a9595bea4871e3d9a05 (patch)
treebb3dbd019aad52134f30ef99b9066dfac27d6596 /libsieve/sieve.y
parentdab2a03e9ed8ca6f5ba9937b7adf7cd40b284edd (diff)
downloadmailutils-a6a6d420ed2e8f4924d25a9595bea4871e3d9a05.tar.gz
mailutils-a6a6d420ed2e8f4924d25a9595bea4871e3d9a05.tar.bz2
Implement compilation of Sieve sources from the memory.
* include/mailutils/libsieve.h (mu_sieve_compile_buffer): New function. * libsieve/sieve.h (sieve_lex_begin_string): New function. * libsieve/sieve.l: Remove support for AT&T lex. (sieve_lex_begin_string): New function. * libsieve/sieve.y (mu_sieve_compile_buffer): New function. * mailbox/header.c: Fix indentation.
Diffstat (limited to 'libsieve/sieve.y')
-rw-r--r--libsieve/sieve.y24
1 files changed, 24 insertions, 0 deletions
diff --git a/libsieve/sieve.y b/libsieve/sieve.y
index bd51683e5..1a9f30501 100644
--- a/libsieve/sieve.y
+++ b/libsieve/sieve.y
@@ -628,6 +628,30 @@ mu_sieve_compile (mu_sieve_machine_t mach, const char *name)
return rc;
}
+int
+mu_sieve_compile_buffer (mu_sieve_machine_t mach,
+ const char *buf, int bufsize, const char *fname, int line)
+{
+ int rc;
+
+ mu_sieve_machine_begin (mach, fname);
+
+ if (sieve_lex_begin_string (buf, bufsize, fname, line) == 0)
+ {
+ rc = yyparse ();
+ if (sieve_error_count)
+ rc = 1;
+ sieve_lex_finish ();
+ }
+ else
+ rc = 1;
+
+ mu_sieve_machine_finish (mach);
+ if (rc)
+ mu_sieve_machine_destroy (&mach);
+ return rc;
+}
+
static void
_branch_fixup (size_t start, size_t end)
{

Return to:

Send suggestions and report system problems to the System administrator.