gbranden pushed a commit to branch master
in repository groff.
commit 5da07731dddcd6334a5816560d5061d743e0ffcb
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 16 15:14:08 2026 -0600
src/preproc/pic/lex.cpp: Boolify "BOL" handling.
* src/preproc/pic/lex.cpp:
(class input_stack): Demote member variable `bol_flag` from `int` to
`bool` and rename it `at_beginning_of_line`. Demote second argument
to `push_back()` member function from `int` to `bool` and default it
with Boolean, not integer, literal. Demote member function `bol()`'s
return type from `int` to `bool` and rename it
`is_at_beginning_of_line()`.
(input_stack::at_beginning_of_line): Assign to (static) class member
variable of `bool` type using Boolean, not integer, literal.
(input_stack::bol): Rename this...
(input_stack::is_at_beginning_of_line): ...to this, and update name of
private variable dereferenced from `bol_flag` to
`at_beginning_of_line`.
(input_stack::clear): Assign Boolean literal to `at_beginning_of_line`
instead of integer to `bol_flag`.
(input_stack::get_char)
(input_stack::push_back): Assign to `at_beginning_of_line` instead
`bol_flag`.
(input_stack::push_back): Rename second argument from `was_bol` to
`was_at_bol`.
(get_token): Rename local variable `bol` to `is_at_bol` and demote it
from `int` to `bool`. Assign to it with value of
`is_at_beginning_of_line()` member function, not `bol()`.
Continues the long process of fixing Savannah #66672.
---
ChangeLog | 29 +++++++++++++++++++++++++++++
src/preproc/pic/lex.cpp | 24 ++++++++++++------------
2 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ca845fb3d..ac17944bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2026-11-16 G. Branden Robinson <[email protected]>
+
+ * src/preproc/pic/lex.cpp: Boolify "BOL" handling.
+ (class input_stack): Demote member variable `bol_flag` from
+ `int` to `bool` and rename it `at_beginning_of_line`. Demote
+ second argument to `push_back()` member function from `int` to
+ `bool` and default it with Boolean, not integer, literal.
+ Demote member function `bol()`'s return type from `int` to
+ `bool` and rename it `is_at_beginning_of_line()`.
+ (input_stack::at_beginning_of_line): Assign to (static) class
+ member variable of `bool` type using Boolean, not integer,
+ literal.
+ (input_stack::bol): Rename this...
+ (input_stack::is_at_beginning_of_line): ...to this, and update
+ name of private variable dereferenced from `bol_flag` to
+ `at_beginning_of_line`.
+ (input_stack::clear): Assign Boolean literal to
+ `at_beginning_of_line` instead of integer to `bol_flag`.
+ (input_stack::get_char)
+ (input_stack::push_back): Assign to `at_beginning_of_line`
+ instead `bol_flag`.
+ (input_stack::push_back): Rename second argument from `was_bol`
+ to `was_at_bol`.
+ (get_token): Rename local variable `bol` to `is_at_bol` and
+ demote it from `int` to `bool`. Assign to it with value of
+ `is_at_beginning_of_line()` member function, not `bol()`.
+
+ Continues the long process of fixing Savannah #66672.
+
2026-11-16 G. Branden Robinson <[email protected]>
* src/preproc/pic/lex.cpp (class copy_thru_input): Boolify
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index 963cdfa84..b437f261c 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -274,23 +274,23 @@ int argument_macro_input::peek()
class input_stack {
static input *current_input;
- static int bol_flag; // TODO: boolify
+ static bool at_beginning_of_line;
public:
static void push(input *);
static void clear();
static int get_char();
static int peek_char();
static bool get_location(const char **, int *);
- static void push_back(unsigned char, int = 0);
- static int bol();
+ static void push_back(unsigned char, bool = false);
+ static bool is_at_beginning_of_line();
};
-int input_stack::bol_flag = 0;
+bool input_stack::at_beginning_of_line = false;
input *input_stack::current_input = 0 /* nullptr */;
-inline int input_stack::bol()
+inline bool input_stack::is_at_beginning_of_line()
{
- return bol_flag;
+ return at_beginning_of_line;
}
void input_stack::clear()
@@ -300,7 +300,7 @@ void input_stack::clear()
current_input = current_input->next;
delete tem;
}
- bol_flag = 1;
+ at_beginning_of_line = true;
}
void input_stack::push(input *in)
@@ -326,7 +326,7 @@ int input_stack::get_char()
while (current_input != 0) {
int c = current_input->get();
if (c != EOF) {
- bol_flag = ('\n' == c);
+ at_beginning_of_line = ('\n' == c);
return c;
}
// don't pop the top-level input off the stack
@@ -378,10 +378,10 @@ int char_input::peek()
return c;
}
-void input_stack::push_back(unsigned char c, int was_bol)
+void input_stack::push_back(unsigned char c, bool was_at_bol)
{
push(new char_input(c));
- bol_flag = was_bol;
+ at_beginning_of_line = was_at_bol;
}
bool input_stack::get_location(const char **fnp, int *lnp)
@@ -958,9 +958,9 @@ static int get_token(bool want_macro_expansion = true)
context_buffer.clear();
for (;;) {
int n = 0;
- int bol = input_stack::bol();
+ bool is_at_bol = input_stack::is_at_beginning_of_line();
int c = input_stack::get_char();
- if (bol && (c == command_char)) {
+ if (is_at_bol && (c == command_char)) {
token_buffer.clear();
token_buffer += c;
// the newline is not part of the token
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit