Introduce \. as a NOP command. The purpose of this is to act as a
[sgt/halibut] / input.c
diff --git a/input.c b/input.c
index 9d165fa..95a7709 100644 (file)
--- a/input.c
+++ b/input.c
@@ -162,6 +162,7 @@ enum {
     c__invalid,                               /* invalid command */
     c__comment,                               /* comment command (\#) */
     c__escaped,                               /* escaped character */
+    c__nop,                           /* no-op */
     c__nbsp,                          /* nonbreaking space */
     c_A,                              /* appendix heading */
     c_B,                              /* bibliography entry */
@@ -231,6 +232,7 @@ static void match_kw(token *tok) {
     static const struct { char const *name; int id; } keywords[] = {
        {"#", c__comment},             /* comment command (\#) */
        {"-", c__escaped},             /* nonbreaking hyphen */
+       {".", c__nop},                 /* no-op */
        {"A", c_A},                    /* appendix heading */
        {"B", c_B},                    /* bibliography entry */
        {"BR", c_BR},                  /* bibliography rewrite */
@@ -360,7 +362,7 @@ token get_token(input *in) {
     } else if (c == '\\') {           /* tok_cmd */
        c = get(in, &cpos);
        if (c == '-' || c == '\\' || c == '_' ||
-           c == '#' || c == '{' || c == '}') {
+           c == '#' || c == '{' || c == '}' || c == '.') {
            /* single-char command */
            rdadd(&rs, c);
        } else if (c == 'u') {
@@ -905,6 +907,11 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) {
                break;
            }
 
+           if (t.type == tok_cmd && t.cmd == c__nop) {
+               dtor(t), t = get_token(in);
+               continue;              /* do nothing! */
+           }
+
            if (t.type == tok_cmd && t.cmd == c__escaped) {
                t.type = tok_word;     /* nice and simple */
                t.aux = 0;             /* even if `\-' - nonbreaking! */