test: Improve parser indentation test

We need to be fancier with our regexp now that pipes are in the grammar.
Don't match them in comments of course!
This commit is contained in:
James Shubin
2023-10-17 15:20:26 -04:00
parent 361b671799
commit 04fd330733

View File

@@ -19,7 +19,10 @@ function parser-indentation() {
if grep $'\t|' "$1"; then # indent the pipe too if grep $'\t|' "$1"; then # indent the pipe too
return 1 return 1
fi fi
if grep ' |' "$1"; then # indent the pipe too (no spaces!) # indent the pipe too (no spaces!)
# skip over any lines with leading comments
# the $ before the \t magically makes grep match the tab somehow...
if grep ' |' "$1" | grep -v '^['$'\t'']*// '; then
return 1 return 1
fi fi
if grep '^ ' "$1"; then # format with tabs, no leading spaces if grep '^ ' "$1"; then # format with tabs, no leading spaces