summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>1999-11-07 16:14:23 +0000
committerSimon Tatham <anakin@pobox.com>1999-11-07 16:14:23 +0000
commit18171f661f78e141d24c3990c5db4346213d440b (patch)
tree3db6801ddc54bd721bb56310df555851409020ef /input.c
parent06bbfc1a23c38d623c88adffb681e89a367ab5c5 (diff)
downloadhalibut-18171f661f78e141d24c3990c5db4346213d440b.zip
halibut-18171f661f78e141d24c3990c5db4346213d440b.tar.gz
halibut-18171f661f78e141d24c3990c5db4346213d440b.tar.bz2
halibut-18171f661f78e141d24c3990c5db4346213d440b.tar.xz
Added \q{...} for quoted text
[originally from svn r274]
Diffstat (limited to 'input.c')
-rw-r--r--input.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/input.c b/input.c
index 2e0b583..a312155 100644
--- a/input.c
+++ b/input.c
@@ -187,6 +187,7 @@ enum {
c_n, /* numbered list */
c_nocite, /* bibliography trickery */
c_preamble, /* document preamble text */
+ c_q, /* quote marks */
c_rule, /* horizontal rule */
c_title, /* document title */
c_u, /* aux field is char code */
@@ -249,6 +250,7 @@ static void match_kw(token *tok) {
{"n", c_n}, /* numbered list */
{"nocite", c_nocite}, /* bibliography trickery */
{"preamble", c_preamble}, /* document preamble text */
+ {"q", c_q}, /* quote marks */
{"rule", c_rule}, /* horizontal rule */
{"title", c_title}, /* document title */
{"versionid", c_versionid}, /* document RCS id */
@@ -504,6 +506,7 @@ static void read_file(paragraph ***ret, input *in, index *idx) {
stack_style = 2, /* \e, \c, \cw */
stack_idx = 4, /* \I, \i, \ii */
stack_hyper = 8, /* \W */
+ stack_quote = 16, /* \q */
} type;
word **whptr; /* to restore from \u alternatives */
word **idximplicit; /* to restore from \u alternatives */
@@ -807,6 +810,20 @@ static void read_file(paragraph ***ret, input *in, index *idx) {
if (indexing)
addword(wd, &idximplicit);
}
+ if (sitem->type & stack_quote) {
+ wd.text = NULL;
+ wd.type = toquotestyle(style);
+ wd.alt = NULL;
+ wd.aux = quote_Close;
+ wd.fpos = t.pos;
+ wd.breaks = FALSE;
+ if (!indexing || index_visible)
+ addword(wd, &whptr);
+ if (indexing) {
+ rdadd(&indexstr, L'"');
+ addword(wd, &idximplicit);
+ }
+ }
}
sfree(sitem);
break;
@@ -846,6 +863,28 @@ static void read_file(paragraph ***ret, input *in, index *idx) {
}
}
break;
+ case c_q:
+ dtor(t), t = get_token(in);
+ if (t.type != tok_lbrace) {
+ error(err_explbr, &t.pos);
+ } else {
+ wd.text = NULL;
+ wd.type = toquotestyle(style);
+ wd.alt = NULL;
+ wd.aux = quote_Open;
+ wd.fpos = t.pos;
+ wd.breaks = FALSE;
+ if (!indexing || index_visible)
+ addword(wd, &whptr);
+ if (indexing) {
+ rdadd(&indexstr, L'"');
+ addword(wd, &idximplicit);
+ }
+ sitem = mknew(struct stack_item);
+ sitem->type = stack_quote;
+ stk_push(parsestk, sitem);
+ }
+ break;
case c_K:
case c_k:
case c_W: