gbranden pushed a commit to branch master
in repository groff.
commit 445def09afa06884bab003ca0456218d56577675
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Dec 21 00:55:25 2025 -0600
[troff]: Refactor (1/2).
Split `TOKEN_HORIZONTAL_MOTION` token type into two, leaving the
existing one for `\0`, `\^`, and `\|` escape sequences, and creating a
new `TOKEN_DELIMITED_HORIZONTAL_MOTION` for the parameterized `\h`
escape sequence.
* src/roff/troff/token.h (class token): Add new
`TOKEN_DELIMITED_HORIZONTAL_MOTION` enumeration constant.
(token::is_horizontal_motion): Return `true` for both new and old
token types.
---
ChangeLog | 13 +++++++++++++
src/roff/troff/token.h | 6 ++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c283a0e3f..ae7644733 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2025-12-21 G. Branden Robinson <[email protected]>
+
+ [troff]: Refactor. Split `TOKEN_HORIZONTAL_MOTION` token type
+ into two, leaving the existing one for `\0`, `\^`, and `\|`
+ escape sequences, and creating a new
+ `TOKEN_DELIMITED_HORIZONTAL_MOTION` for the parameterized `\h`
+ escape sequence.
+
+ * src/roff/troff/token.h (class token): Add new
+ `TOKEN_DELIMITED_HORIZONTAL_MOTION` enumeration constant.
+ (token::is_horizontal_motion): Return `true` for both new and
+ old token types.
+
2025-12-21 G. Branden Robinson <[email protected]>
* src/roff/troff/token.h (class token): Trivially refactor.
diff --git a/src/roff/troff/token.h b/src/roff/troff/token.h
index fcec8466a..f38d6b5b6 100644
--- a/src/roff/troff/token.h
+++ b/src/roff/troff/token.h
@@ -44,12 +44,13 @@ class token {
TOKEN_BACKSPACE, // ^H
TOKEN_BEGIN_TRAP,
TOKEN_CHAR, // ordinary character
+ TOKEN_DELIMITED_HORIZONTAL_MOTION, // \h
TOKEN_DUMMY, // dummy character: \&
TOKEN_EMPTY, // this is the initial value
TOKEN_END_TRAP,
TOKEN_EOF, // end of file
TOKEN_ESCAPE, // \e
- TOKEN_HORIZONTAL_MOTION, // horizontal motion: \|, \^, \0, \h
+ TOKEN_HORIZONTAL_MOTION, // fixed horizontal motion: \|, \^, \0
TOKEN_HYPHEN_INDICATOR, // \%
TOKEN_INDEXED_CHAR, // \N
TOKEN_INTERRUPT, // \c
@@ -181,7 +182,8 @@ inline bool token::is_unstretchable_space()
inline bool token::is_horizontal_motion()
{
- return (TOKEN_HORIZONTAL_MOTION == type);
+ return ((TOKEN_HORIZONTAL_MOTION == type)
+ || (TOKEN_DELIMITED_HORIZONTAL_MOTION == type));
}
inline bool token::is_special_character()
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit