Skip to contentSkip to conversation

punctcheck.pl updates

PATCH In review Akira Yokosawa 2 participants 6 messages Apr 4, 2022

lore
Share & tools
lore
#0 lore raw

v2 cover punctcheck.pl updates

Hi Paul,

Trying again.

So, this series adds patterns in punctcheck.pl to detect misuses of punctuation markers "\@.", ".\@", and its friends.

Patch 1/3 adds the new pattern.
Patch 2/3 adds hint messages to help you and other contributors see what is wrong. Hopefully the added messages are clear enough. Patch 3/3 fixes existing misuses detected by the added pattern.

Thanks, Akira
--
Akira Yokosawa (3):
punctcheck.pl: Add pattern to catch reverse use of period markers punctcheck.pl: Add hints in complaint messages
Fix period markers

 glossary.tex            |  2 +-
 memorder/memorder.tex   |  2 +-
 together/applyrcu.tex   |  2 +-
 utilities/punctcheck.pl | 15 +++++++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)

base-commit: 5f28b7cb0d4c447c9d6397770906c7cb4c96832c

Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/3 punctcheck.pl: Add pattern to catch reverse use of period markers

End-of-sentence markers ("\@.") make sense when they follow uppercase letters.
Mid-sentence markers (".\@") make sense when they follow lowercase letters.

Add patterns to cache reverse uses.

---
 utilities/punctcheck.pl | 6 ++++++
 1 file changed, 6 insertions(+)
utilities/punctcheck.pl +6 -0
index 7d23cc57..8820bf9c 100755
@@ -91,6 +91,12 @@ sub check_line {
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^%]/){
 	    $ng += 1;
 	}
+	if ($line =~ /[a-z][\)\}\']*\\\@[\.\?\!\:][\)\}\']*\s/) {
+	    $ng += 1;
+	}
+	if ($line =~ /[A-Z][\)\}\']*[\.\?\!\:]\\\@[\)\}\']*\s/) {
+	    $ng += 1;
+	}
 	if ($ng) {
 	    print $ARGV[0], ':', $line_num, ':', $line_raw;
 	}
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/3 punctcheck.pl: Add hints in complaint messages

In reply to Akira Yokosawa

To help Paul (and other contributors), print a hint in front of the violating line.

---
 utilities/punctcheck.pl | 9 +++++++++
 1 file changed, 9 insertions(+)
utilities/punctcheck.pl +9 -0
index 8820bf9c..94cbafc9 100755
@@ -71,6 +71,8 @@ sub check_line {
 		$next_line =~ /\\E?QuickQuizEnd[BEM]?/ ||
 		$next_line =~ /\\end\{(quot|enum|item|sequ)/ ) {
 		$ng -= 1;
+	    } else {
+		print "vvv Hint: sentence ending with an uppercase needs \"\\\@.\" vvv\n";
 	    }
 	}
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+[^%]/ ||
@@ -80,21 +82,28 @@ sub check_line {
 	    if ($line =~ /^(?=[\s]*+[^%])[^%]*[a-z][\)\}\']*[\.\?\!][\)\}\']*\s+\\\\/ ||
 		$line =~ /^(?=[\s]*+[^%])[^%]*.*[\.:][\)\}\']*\s+\\\\/ ) {
 		$ng -= 1;
+	    } else {
+		print "vvv Hint: end of sentence needs new line vvv\n";
 	    }
 	}
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*[^~]\\cite/) {
 	    $ng += 1;
 	    if ($line =~ /^(?=[\s]*+[^%])[^%]*~\(\\cite/) {
 		$ng -= 1;
+	    } else {
+		print "vvv Hint: \\cite{} needs a \"~\" in front vvv\n";
 	    }
 	}
 	if ($line =~ /^(?=[\s]*+[^%])[^%]*\\\@[\.\?\!\:][\)\}\']*\s+[^%]/){
 	    $ng += 1;
+	    print "vvv Hint: end of sentence needs new line vvv\n";
 	}
 	if ($line =~ /[a-z][\)\}\']*\\\@[\.\?\!\:][\)\}\']*\s/) {
+	    print "vvv Hint: should be \"xxx.\\\@\" vvv\n";
 	    $ng += 1;
 	}
 	if ($line =~ /[A-Z][\)\}\']*[\.\?\!\:]\\\@[\)\}\']*\s/) {
+	    print "vvv Hint: should be \"XXX\\\@.\" vvv\n";
 	    $ng += 1;
 	}
 	if ($ng) {
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/3 Fix period markers

In reply to Akira Yokosawa

These are caught by patterns added in punctcheck.pl.

---
 glossary.tex          | 2 +-
 memorder/memorder.tex | 2 +-
 together/applyrcu.tex | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
glossary.tex +1 -1
index 46c68bbe..6038c9ed 100644
@@ -143,7 +143,7 @@
 	takes a pointer, and old value, and a new value.
 	If the pointed-to value is equal to the old value, it is atomically
 	replaced with the new value.
-	There is some variety in CAS API.\@
+	There is some variety in CAS API\@.
 	One variation returns the actual pointed-to value, so that the
 	caller compares the CAS return value to the specified old value,
 	with equality indicating a successful CAS operation.
memorder/memorder.tex +1 -1
index 9792099f..cb91de93 100644
@@ -3303,7 +3303,7 @@ As it turns out, quite a bit:
 	same lock, and vice versa?
 \item	Suppose that a given CPU or thread executes one access
 	(call it ``A''), releases a lock, reacquires that same lock,
-	then executes another access (call it ``B'').\@
+	then executes another access (call it ``B'')\@.
 	Is some other CPU or thread not holding that lock guaranteed to
 	see A and B in order?
 \item	As above, but with the lock reacquisition carried out by some
together/applyrcu.tex +1 -1
index 934fbed5..a3ee559e 100644
@@ -816,7 +816,7 @@ For example, in Linux kernel v5.16, the \co{khugepaged_scan_file()}
 function checks to see if some other task needs the current CPU
 using \co{need_resched()}, and if so invokes \co{xas_pause()} to
 adjust the traveral's iterator appropriately, and then invokes
-\co{cond_resched_rcu()} to yield the CPU.\@
+\co{cond_resched_rcu()} to yield the CPU\@.
 In turn, the \co{cond_resched_rcu()} function invokes \co{rcu_read_unlock()},
 \co{cond_resched()}, and finally \co{rcu_read_lock()} to drop out of
 the RCU read-side critical section in order to yield the CPU.
Signature · 1 line
2.25.1
#4 lore raw

[PATCH -perfbook v2 4/3] together/applyrcu: Fix typo

In reply to Akira Yokosawa

---
And I noticed this in one of the hunks in Patch 3/3. Sending as a follow up.

Thanks, Akira
--

 together/applyrcu.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
together/applyrcu.tex +1 -1
index a3ee559e..2a5a3c12 100644
@@ -815,7 +815,7 @@ way of stopping in the middle and resuming later.
 For example, in Linux kernel v5.16, the \co{khugepaged_scan_file()}
 function checks to see if some other task needs the current CPU
 using \co{need_resched()}, and if so invokes \co{xas_pause()} to
-adjust the traveral's iterator appropriately, and then invokes
+adjust the travesal's iterator appropriately, and then invokes
 \co{cond_resched_rcu()} to yield the CPU\@.
 In turn, the \co{cond_resched_rcu()} function invokes \co{rcu_read_unlock()},
 \co{cond_resched()}, and finally \co{rcu_read_lock()} to drop out of
Signature · 1 line
2.25.1
#5 lore raw
In reply to Akira Yokosawa
Quoted 11 lines · Akira Yokosawa

Hi Paul,

Trying again.

So, this series adds patterns in punctcheck.pl to detect misuses of punctuation markers "\@.", ".\@", and its friends.

Patch 1/3 adds the new pattern.
Patch 2/3 adds hint messages to help you and other contributors see what is wrong. Hopefully the added messages are clear enough. Patch 3/3 fixes existing misuses detected by the added pattern.

Much nicer! I queued and pushed all four, thank you!!!

Thanx, Paul

Quoted 18 lines

Thanks, Akira
--
Akira Yokosawa (3):
punctcheck.pl: Add pattern to catch reverse use of period markers punctcheck.pl: Add hints in complaint messages
Fix period markers

 glossary.tex            |  2 +-
 memorder/memorder.tex   |  2 +-
 together/applyrcu.tex   |  2 +-
 utilities/punctcheck.pl | 15 +++++++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)

base-commit: 5f28b7cb0d4c447c9d6397770906c7cb4c96832c

Signature · 1 line
2.25.1