X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=parse.cc;h=8e7de38b3aec6a52f57a3f72bb23a98158f3aee4;hb=a4b921dcbcc63c6ac28949d16be531f2f4465eab;hp=cc0a58235e1c35e119c5190eb9a1ebdd689ef549;hpb=50b49b5bf24f448fbcbac99099ef9bad72f89beb;p=paperjam.git diff --git a/parse.cc b/parse.cc index cc0a582..8e7de38 100644 --- a/parse.cc +++ b/parse.cc @@ -78,7 +78,8 @@ static token_type get_next_token() while (*in_pos >= 'A' && *in_pos <= 'Z' || *in_pos >= 'a' && *in_pos <= 'z' || *in_pos >= '0' && *in_pos <= '9' || - *in_pos == '_') + *in_pos == '_' || + *in_pos == '-') token += *in_pos++; return TOK_IDENT; } @@ -218,7 +219,14 @@ static double parse_dimen(const arg_def *adef) t = next_token(); if (t != TOK_IDENT) - parse_error("Parameter %s must have a unit", adef->name); + { + if (is_zero(tmp)) + { + return_token(); + return 0; + } + parse_error("Parameter %s must have a unit", adef->name); + } for (uint i=0; units[i].name; i++) if (token == units[i].name) return tmp * units[i].multiplier; @@ -467,7 +475,14 @@ static void instantiate(list &cmds) { for (auto c: cmds) { - c->exec = c->def->constructor(c); + try + { + c->exec = c->def->constructor(c); + } + catch (exception &e) + { + die("Error in %s: %s", c->def->name, e.what()); + } if (c->pipe) { for (auto pb: c->pipe->branches)