Skip to content

Commit f3660cb

Browse files
jensmaurerzygoloid
authored andcommitted
[std] Enforce comment alignment in 'codeblocktu' environments.
Also fix existing offenders.
1 parent 9a19e01 commit f3660cb

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

source/basic.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@
11291129

11301130
\begin{codeblocktu}{Translation unit \#3}
11311131
import R;
1132-
int main() { return sq(9); } // OK: \tcode{sq} from module \tcode{Q}
1132+
int main() { return sq(9); } // OK: \tcode{sq} from module \tcode{Q}
11331133
\end{codeblocktu}
11341134
\end{example}
11351135
\end{note}

source/templates.tex

+7-7
Original file line numberDiff line numberDiff line change
@@ -5641,8 +5641,8 @@
56415641
export module A;
56425642
export template<typename T>
56435643
void f(T t) {
5644-
cat(t, t); // \#1
5645-
dog(t, t); // \#2
5644+
cat(t, t); // \#1
5645+
dog(t, t); // \#2
56465646
}
56475647
\end{codeblocktu}
56485648

@@ -5664,7 +5664,7 @@
56645664

56655665
\begin{codeblocktu}{Module interface unit of \tcode{C1}}
56665666
module;
5667-
#include "foo.h" // \tcode{dog} not referenced, discarded
5667+
#include "foo.h" // \tcode{dog} not referenced, discarded
56685668
export module C1;
56695669
import B;
56705670
export template<typename T>
@@ -5676,7 +5676,7 @@
56765676
\begin{codeblocktu}{Translation unit}
56775677
import C1;
56785678
void i() {
5679-
h(0); // error: \tcode{dog} not found at \#2
5679+
h(0); // error: \tcode{dog} not found at \#2
56805680
}
56815681
\end{codeblocktu}
56825682

@@ -5689,7 +5689,7 @@
56895689

56905690
\begin{codeblocktu}{Module interface unit of \tcode{C2}}
56915691
module;
5692-
#include "bar.h" // imports header unit \tcode{"bar.h"}
5692+
#include "bar.h" // imports header unit \tcode{"bar.h"}
56935693
export module C2;
56945694
import B;
56955695
export template<typename T>
@@ -5701,8 +5701,8 @@
57015701
\begin{codeblocktu}{Translation unit}
57025702
import C2;
57035703
void k() {
5704-
j(0); // OK, \tcode{dog} found in instantiation context:
5705-
// visible at end of module interface unit of \tcode{C2}
5704+
j(0); // OK, \tcode{dog} found in instantiation context:
5705+
// visible at end of module interface unit of \tcode{C2}
57065706
}
57075707
\end{codeblocktu}
57085708
\end{example}

tools/check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ done | grep . && exit 1
6161

6262
# Comment not aligned to multiple of four. (Ignore lines with "@".)
6363
for f in $texfiles; do
64-
sed -n '/begin{codeblock}/,/end{codeblock}/{/^[^@]*[^ @][^@]*\/\//{=;p}}' $f |
64+
sed -n '/begin{codeblock\(tu\)\?}/,/end{codeblock\(tu\)\?}/{/^[^@]*[^ @][^@]*\/\//{=;p}}' $f |
6565
# prefix output with filename and line
6666
sed '/^[0-9]\+$/{N;s/\n/:/}' | sed "s/.*/$f:&/" |
6767
awk '{ match($0,"^[-a-z0-9]*[.]tex:[0-9]*:"); n=match(substr($0,RLENGTH+1),"[ ;]//"); if (n % 4 != 0) print $0 " <--- comment starts in column " n; }'

0 commit comments

Comments
 (0)