X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=mp.c;h=416b4f92065ef79716e7f966c3102e995071a112;hp=c5702c625bf2125afd10f3dab8ce1627053ddb07;hb=12f3368848dadafec9f00a137feff7f3597939be;hpb=2031b9cab9304b02c0372f73eef54d9501277031 diff --git a/mp.c b/mp.c index c5702c62..416b4f92 100644 --- a/mp.c +++ b/mp.c @@ -6,7 +6,7 @@ * This file contains the public and the private API of the flex/bison based * mood parser. * - * The public API (at the bottom of the file) allows to parse the same mood + * 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 call is \ref mp_init(), which analyzes the given mood @@ -61,8 +61,8 @@ struct mp_context { * * This function turns a generalized C99 string literal like "xyz\n" into a C * string (containing the three characters 'x', 'y' and 'z', followed by a - * newline character and the terminating zero byte). The function allows to - * specify different quote characters so that, for example, regular expression + * newline character and the terminating zero byte). The function receives + * quote characters as an argument so that, for example, regular expression * patterns enclosed in '/' can be parsed as well. To parse a proper string * literal, one has to pass two double quotes as the second argument. * @@ -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;