aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit154c74a463b9f4d0c87a3161a60df5ce17c366c9 (patch)
tree71d24bb33de21624f0ddc202816da1a8e7025f9b /term.c
parent92c367a844f2f26d325d4ee6ca032894e94f7a06 (diff)
downloadmandoc-154c74a463b9f4d0c87a3161a60df5ce17c366c9.tar.gz
mandoc-154c74a463b9f4d0c87a3161a60df5ce17c366c9.tar.zst
mandoc-154c74a463b9f4d0c87a3161a60df5ce17c366c9.zip
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.c44
1 files changed, 6 insertions, 38 deletions
diff --git a/term.c b/term.c
index bdf73bf2..3d1f4edd 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.179 2011/03/17 08:49:34 kristaps Exp $ */
+/* $Id: term.c,v 1.180 2011/03/17 09:16:38 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
}