summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-04-10 08:59:19 +0000
committerSimon Tatham <anakin@pobox.com>2004-04-10 08:59:19 +0000
commitcb859ab83ed22a1b0dc9fd017cb0d68e0037d750 (patch)
tree1218ea2baf44c3ec3b312c3a6b2606e78fcce06c /input.c
parent221e2fcc83aa527bf515d40a754d69dc5793bb4f (diff)
downloadhalibut-cb859ab83ed22a1b0dc9fd017cb0d68e0037d750.zip
halibut-cb859ab83ed22a1b0dc9fd017cb0d68e0037d750.tar.gz
halibut-cb859ab83ed22a1b0dc9fd017cb0d68e0037d750.tar.bz2
halibut-cb859ab83ed22a1b0dc9fd017cb0d68e0037d750.tar.xz
Info backend now takes care to avoid magic characters in node names
and index terms (the Info format doesn't like them). In the course of this I've had to introduce some infrastructure for carrying a filepos forward from the definition of every RHS index term so that a particular backend can provide a usefully localised report of which index term had a problem. [originally from svn r4051]
Diffstat (limited to 'input.c')
-rw-r--r--input.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/input.c b/input.c
index 429b4d5..cb6cf9c 100644
--- a/input.c
+++ b/input.c
@@ -528,6 +528,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
} type;
word **whptr; /* to restore from \u alternatives */
word **idximplicit; /* to restore from \u alternatives */
+ filepos fpos;
} *sitem;
stack parsestk;
struct crossparaitem {
@@ -988,6 +989,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
/* Error recovery: push nop */
sitem = mknew(struct stack_item);
sitem->type = stack_nop;
+ sitem->fpos = t.pos;
stk_push(parsestk, sitem);
break;
case tok_rbrace:
@@ -1024,7 +1026,8 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
}
indexing = FALSE;
rdadd(&indexstr, L'\0');
- index_merge(idx, FALSE, indexstr.text, idxwordlist);
+ index_merge(idx, FALSE, indexstr.text,
+ idxwordlist, &sitem->fpos);
sfree(indexstr.text);
}
if (sitem->type & stack_hyper) {
@@ -1110,6 +1113,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
addword(wd, &idximplicit);
}
sitem = mknew(struct stack_item);
+ sitem->fpos = t.pos;
sitem->type = stack_quote;
stk_push(parsestk, sitem);
}
@@ -1189,6 +1193,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
* Special cases: \W{}\c, \W{}\e, \W{}\cw
*/
sitem = mknew(struct stack_item);
+ sitem->fpos = wd.fpos;
sitem->type = stack_hyper;
if (t.type == tok_cmd &&
(t.cmd == c_e || t.cmd == c_c || t.cmd == c_cw)) {
@@ -1220,6 +1225,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
/* Error recovery: eat lbrace, push nop. */
dtor(t), t = get_token(in);
sitem = mknew(struct stack_item);
+ sitem->fpos = t.pos;
sitem->type = stack_nop;
stk_push(parsestk, sitem);
}
@@ -1232,6 +1238,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
word_Emph);
spcstyle = tospacestyle(style);
sitem = mknew(struct stack_item);
+ sitem->fpos = t.pos;
sitem->type = stack_style;
stk_push(parsestk, sitem);
}
@@ -1245,10 +1252,12 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
/* Error recovery: eat lbrace, push nop. */
dtor(t), t = get_token(in);
sitem = mknew(struct stack_item);
+ sitem->fpos = t.pos;
sitem->type = stack_nop;
stk_push(parsestk, sitem);
}
sitem = mknew(struct stack_item);
+ sitem->fpos = t.pos;
sitem->type = stack_idx;
dtor(t), t = get_token(in);
/*
@@ -1318,6 +1327,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
* paragraph.
*/
sitem = mknew(struct stack_item);
+ sitem->fpos = t.pos;
sitem->type = stack_ualt;
sitem->whptr = whptr;
sitem->idximplicit = idximplicit;