groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 10/24: [troff]: EOF makes `has_arg()` return false.


From: G. Branden Robinson
Subject: [groff] 10/24: [troff]: EOF makes `has_arg()` return false.
Date: Sun, 10 Nov 2024 14:56:21 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit a4822b042458a1ce98157812a3a9c310c334d3a0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Nov 9 03:02:34 2024 -0600

    [troff]: EOF makes `has_arg()` return false.
    
    * src/roff/troff/input.cpp (has_arg): Return false at EOF, too.
    
    Before:
    
    $ printf '.rm' | ~/groff-HEAD/bin/groff -ww
    
    Now:
    
    $ printf '.rm' | ./build/test-groff -ww
    troff: warning: name removal request expects arguments
---
 ChangeLog                | 4 ++++
 src/roff/troff/input.cpp | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e40bf6398..deb929d67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-11-09  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (has_arg): Return false at EOF, too.
+
 2024-11-08  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [man,mdoc,mdoc-old]: Unit-test vertical margins/gross layout.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 71a56c3a3..e6bb1f5f3 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1907,7 +1907,7 @@ void token::skip()
 // delimited argument (`tl`).
 bool has_arg(bool want_peek)
 {
-  if (tok.is_newline())
+  if (tok.is_newline() || tok.is_eof())
     return false;
   if (want_peek) {
     int c;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]