summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-06-12 21:53:26 +0000
committerSimon Tatham <anakin@pobox.com>2004-06-12 21:53:26 +0000
commitcb775f9b2f26acb3bb34f357b778b42d70a39eb2 (patch)
treee313fed2920fde280846e3bed86738d6062c4604 /input.c
parenta5d800d080a9eb557082042216636ac872eac7ec (diff)
downloadhalibut-cb775f9b2f26acb3bb34f357b778b42d70a39eb2.zip
halibut-cb775f9b2f26acb3bb34f357b778b42d70a39eb2.tar.gz
halibut-cb775f9b2f26acb3bb34f357b778b42d70a39eb2.tar.bz2
halibut-cb775f9b2f26acb3bb34f357b778b42d70a39eb2.tar.xz
Enforce that \q may not be used anywhere within \c. It shouldn't be
necessary since the whole point of \c should be that the user wants to exercise exact control over the glyphs used, and forbidding it has the useful effect of relieving some backends of having to make difficult decisions: it means the text backend doesn't have to nest two pairs of identical quotes, and the paper backends don't have to downgrade their quote characters if (as is perfectly plausible) the fixed-pitch font doesn't support the same range as the body text fonts. [originally from svn r4277]
Diffstat (limited to 'input.c')
-rw-r--r--input.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/input.c b/input.c
index 59ea326..4eb1d8c 100644
--- a/input.c
+++ b/input.c
@@ -612,6 +612,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
word **whptr; /* to restore from \u alternatives */
word **idximplicit; /* to restore from \u alternatives */
filepos fpos;
+ int in_code;
} *sitem;
stack parsestk;
struct crossparaitem {
@@ -1201,21 +1202,39 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
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);
+ /*
+ * Enforce that \q may not be used anywhere
+ * within \c. (It shouldn't be necessary
+ * since the whole point of \c should be
+ * that the user wants to exercise exact
+ * control over the glyphs used, and
+ * forbidding it has the useful effect of
+ * relieving some backends of having to
+ * make difficult decisions.)
+ */
+ int stype;
+
+ if (style != word_Code && style != word_WeakCode) {
+ 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);
+ }
+ stype = stack_quote;
+ } else {
+ error(err_codequote, &t.pos);
+ stype = stack_nop;
}
sitem = snew(struct stack_item);
sitem->fpos = t.pos;
- sitem->type = stack_quote;
+ sitem->type = stype;
stk_push(parsestk, sitem);
}
break;