summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-03-17 09:16:38 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-03-17 09:16:38 +0000
commite3df96e26436bd256a2aa5a33e49f9166ff6d4b6 (patch)
tree45cda180303addde16f0252611e2e4f7c28a619d /term.c
parentb115f948b8e55e6c3cef4bfa81f62c190af37a59 (diff)
downloadmandoc-e3df96e26436bd256a2aa5a33e49f9166ff6d4b6.tar.gz
Move mdoc_isdelim() into mandoc.h as mandoc_isdelim(). This allows the
removal of manual delimiter checks in html.c and term.c. Finally, add the escaped period as a closing delimiter, removing a TODO to this effect.
Diffstat (limited to 'term.c')
-rw-r--r--term.c42
1 files changed, 5 insertions, 37 deletions
diff --git a/term.c b/term.c
index a106224b..2e24eb3d 100644
--- a/term.c
+++ b/term.c
@@ -463,29 +463,9 @@ term_word(struct termp *p, const char *word)
sv = word;
- if (word[0] && '\0' == word[1])
- switch (word[0]) {
- case('.'):
- /* FALLTHROUGH */
- case(','):
- /* FALLTHROUGH */
- case(';'):
- /* FALLTHROUGH */
- case(':'):
- /* FALLTHROUGH */
- case('?'):
- /* FALLTHROUGH */
- case('!'):
- /* FALLTHROUGH */
- case(')'):
- /* FALLTHROUGH */
- case(']'):
- if ( ! (TERMP_IGNDELIM & p->flags))
- p->flags |= TERMP_NOSPACE;
- break;
- default:
- break;
- }
+ if (DELIM_CLOSE == mandoc_isdelim(word))
+ if ( ! (TERMP_IGNDELIM & p->flags))
+ p->flags |= TERMP_NOSPACE;
if ( ! (TERMP_NOSPACE & p->flags)) {
if ( ! (TERMP_KEEP & p->flags)) {
@@ -548,20 +528,8 @@ term_word(struct termp *p, const char *word)
p->flags |= TERMP_NOSPACE;
}
- /*
- * Note that we don't process the pipe: the parser sees it as
- * punctuation, but we don't in terms of typography.
- */
- if (sv[0] && '\0' == sv[1])
- switch (sv[0]) {
- case('('):
- /* FALLTHROUGH */
- case('['):
- p->flags |= TERMP_NOSPACE;
- break;
- default:
- break;
- }
+ if (DELIM_OPEN == mandoc_isdelim(sv))
+ p->flags |= TERMP_NOSPACE;
}