X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=mp.c;h=416b4f92065ef79716e7f966c3102e995071a112;hp=3f6cfbe6cd297ad2bc34490a77784679f434754f;hb=12f3368848dadafec9f00a137feff7f3597939be;hpb=23af03dbfb283045ff952267ee83c2b7f2ef6380 diff --git a/mp.c b/mp.c index 3f6cfbe6..416b4f92 100644 --- a/mp.c +++ b/mp.c @@ -9,7 +9,7 @@ * The public API (at the bottom of the file) allows parsing the same mood * definition many times in an efficient manner. * - * The first function to all is \ref mp_init(), which analyzes the given mood + * The first function to call is \ref mp_init(), which analyzes the given mood * definition syntactically. It returns the abstract syntax tree of the mood * definition and pre-compiles all regular expression patterns to make later * pattern matching efficient. @@ -491,10 +491,10 @@ int mp_init(const char *definition, int nbytes, struct mp_context **result, struct mp_context *ctx; struct yy_buffer_state *buffer_state; + *result = NULL; if (!definition || nbytes == 0) { /* dummy mood */ if (errmsg) *errmsg = NULL; - *result = NULL; return 0; } ctx = para_calloc(sizeof(*ctx)); @@ -541,6 +541,8 @@ bool mp_eval_row(const struct osl_row *aft_row, struct mp_context *ctx) { if (!ctx) /* dummy mood */ return true; + if (!ctx->ast) /* empty mood */ + return true; assert(aft_row); ctx->aft_row = aft_row; ctx->have_afsi = false;