summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.716
-rw-r--r--mlg.c13
-rw-r--r--private.h3
-rw-r--r--roff.c10
-rw-r--r--tokens.c9
5 files changed, 40 insertions, 11 deletions
diff --git a/index.7 b/index.7
index ff3f0d59..b88246bf 100644
--- a/index.7
+++ b/index.7
@@ -21,8 +21,9 @@ and
.Nm
acts directly on source documents, validating its input and producing a
variety of outputs.
-.Ss Features
-In order to operate properly,
+.\"
+.Ss Validation
+In order to operate sanely,
.Nm
fully validates its input. This includes, but is not limited to, the
following checks:
@@ -40,10 +41,19 @@ macros clobbering a pending
.Sq \&.Bl
scope),
.It
-predefined characters (such as \\*(>= and \\*q),
+predefined characters (such as \\*(>= and \\*q, rendering as \*(>= and \*q,
+respectively),
.It
correctly-ordered document prelude,
+.It
+sane argument values (such as those for
+.Sq \& Dt
+or
+.Sq \& Sm ) ,
+.It
+and so on.
.El
+.Pp
.\"
.Sh ENVIRONMENT
The
diff --git a/mlg.c b/mlg.c
index ac413e3a..52bbb822 100644
--- a/mlg.c
+++ b/mlg.c
@@ -594,10 +594,6 @@ mlg_rofftoken(void *arg, int space, int value)
seq = " ";
sz = 6;
break;
- case (ROFFTok_Null):
- seq = "";
- sz = 0;
- break;
case (ROFFTok_Hyphen):
seq = "‐";
sz = 7;
@@ -670,13 +666,20 @@ mlg_rofftoken(void *arg, int space, int value)
seq = "Nan";
sz = 3;
break;
+ case (ROFFTok_Quote):
+ seq = """;
+ sz = 6;
+ break;
+ default:
+ /* TODO: print error. */
+ return(0);
}
if (space && ! ml_nputs(p->mbuf, " ", 1, &res))
return(0);
p->pos += res;
- if (0 != sz && ! ml_nputs(p->mbuf, seq, sz, &res))
+ if ( ! ml_nputs(p->mbuf, seq, sz, &res))
return(0);
p->pos += res;
diff --git a/private.h b/private.h
index e5a55431..b60686a8 100644
--- a/private.h
+++ b/private.h
@@ -64,7 +64,8 @@ struct md_mbuf {
#define ROFFTok_Infty 24
#define ROFFTok_Bar 25
#define ROFFTok_Nan 26
-#define ROFFTok_MAX 27
+#define ROFFTok_Quote 27
+#define ROFFTok_MAX 28
#define ROFF___ 0
#define ROFF_Dd 1
diff --git a/roff.c b/roff.c
index b30add22..08d10ffb 100644
--- a/roff.c
+++ b/roff.c
@@ -971,12 +971,20 @@ roffdata(struct rofftree *tree, int space, char *buf)
{
int tok;
+ if (0 == *buf)
+ return(1);
+
if (-1 == (tok = rofftok_scan(buf))) {
roff_err(tree, buf, "invalid character sequence");
return(0);
- } else if (ROFFTok_MAX != tok)
+ } else if (ROFFTok_MAX != tok) {
+ if (ROFFTok_Null == tok) { /* FIXME */
+ buf += 2;
+ return(roffdata(tree, space, buf));
+ }
return((*tree->cb.rofftoken)
(tree->arg, space != 0, tok));
+ }
return((*tree->cb.roffdata)(tree->arg,
space != 0, tree->cur, buf));
diff --git a/tokens.c b/tokens.c
index 07cdb671..10d35153 100644
--- a/tokens.c
+++ b/tokens.c
@@ -88,7 +88,12 @@ rofftok_predef(const char *buf)
if ('(' == *buf)
return(rofftok_defined(++buf));
- /* TODO */
+ switch (*buf) {
+ case ('q'):
+ return(ROFFTok_Quote);
+ default:
+ break;
+ }
return(-1);
}
@@ -173,6 +178,8 @@ rofftok_scan(const char *buf)
return(ROFFTok_Hyphen);
case ('*'):
return(rofftok_predef(++buf));
+ case ('\\'):
+ return(ROFFTok_MAX);
default:
break;
}