=================================================================== RCS file: /cvs/mandoc/mandoc.h,v retrieving revision 1.82 retrieving revision 1.84 diff -u -p -r1.82 -r1.84 --- mandoc/mandoc.h 2011/07/21 10:24:35 1.82 +++ mandoc/mandoc.h 2011/07/21 12:30:44 1.84 @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.82 2011/07/21 10:24:35 kristaps Exp $ */ +/* $Id: mandoc.h,v 1.84 2011/07/21 12:30:44 kristaps Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * @@ -112,6 +112,8 @@ enum mandocerr { /* related to equations */ MANDOCERR_EQNARGS, /* bad equation macro arguments */ MANDOCERR_EQNNEST, /* too many nested equation defines */ + MANDOCERR_EQNNSCOPE, /* unexpected equation scope closure*/ + MANDOCERR_EQNSCOPE, /* equation scope open on exit */ /* related to tables */ MANDOCERR_TBL, /* bad table syntax */ @@ -277,9 +279,25 @@ struct tbl_span { struct tbl_span *next; }; +enum eqn_boxt { + EQN_ROOT, /* root of parse tree */ + EQN_TEXT, /* text (number, variable, whatever) */ + EQN_SUBEXPR /* nested subexpression */ +}; + +/* + * A "box" is a parsed mathematical expression as defined by the eqn.7 + * grammar. + */ +struct eqn_box { + enum eqn_boxt type; /* type of node */ + struct eqn_box *child; /* child node */ + struct eqn_box *next; /* next in tree */ + char *text; /* text (or NULL) */ +}; + struct eqn { - size_t sz; - char *data; + struct eqn_box *root; /* root mathematical expression */ int ln; /* invocation line */ int pos; /* invocation position */ };