aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandoc.h
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 12:30:44 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 12:30:44 +0000
commitbb4fb107c337c4a2ff9653f44eb52a91acfe6b4a (patch)
tree311bb493dc3cf6ba1f6495455fa0b26d81ecda6d /mandoc.h
parente0f75c6ac153f58d4ab0b61182736fc07a2ce1dc (diff)
downloadmandoc-bb4fb107c337c4a2ff9653f44eb52a91acfe6b4a.tar.gz
mandoc-bb4fb107c337c4a2ff9653f44eb52a91acfe6b4a.tar.zst
mandoc-bb4fb107c337c4a2ff9653f44eb52a91acfe6b4a.zip
Support nested `{, }' subexpressions in eqn. Document in code.
Diffstat (limited to 'mandoc.h')
-rw-r--r--mandoc.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/mandoc.h b/mandoc.h
index 7c46c763..b585ace8 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.83 2011/07/21 11:34:53 kristaps Exp $ */
+/* $Id: mandoc.h,v 1.84 2011/07/21 12:30:44 kristaps Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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 */
@@ -278,19 +280,24 @@ struct tbl_span {
};
enum eqn_boxt {
- EQN_ROOT,
- EQN_TEXT
+ 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;
- struct eqn_box *child;
- struct eqn_box *next;
- char *text;
+ 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 {
- struct eqn_box *root;
+ struct eqn_box *root; /* root mathematical expression */
int ln; /* invocation line */
int pos; /* invocation position */
};