summary refs log tree commit diff
path: root/bin/sh.l
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-26 21:11:36 -0500
committerJune McEnroe <june@causal.agency>2021-01-26 21:11:36 -0500
commitf15eda25885c5b94e389dc9b8bd3874b82c56828 (patch)
tree8b7685b2231e200fc415e68b679b7cd552835202 /bin/sh.l
parentInstall vi on Linux and nvi on macOS (diff)
downloadsrc-f15eda25885c5b94e389dc9b8bd3874b82c56828.tar.gz
src-f15eda25885c5b94e389dc9b8bd3874b82c56828.zip
Use First state to match keyword at beginning of line
Otherwise keywords at the beginnings of lines with preceeding
whitespace are not matched.
Diffstat (limited to 'bin/sh.l')
-rw-r--r--bin/sh.l5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/sh.l b/bin/sh.l
index 6b9d7223..4579adbe 100644
--- a/bin/sh.l
+++ b/bin/sh.l
@@ -81,6 +81,10 @@ reserved [!{}]|else|do|elif|for|done|fi|then|until|while|if|case|esac
 	return Subst;
 }
 
+"\n" {
+	BEGIN(push(First));
+	return Normal;
+}
 [&();|]|"&&"|";;"|"||" {
 	BEGIN(push(First));
 	return Operator;
@@ -89,7 +93,6 @@ reserved [!{}]|else|do|elif|for|done|fi|then|until|while|if|case|esac
 	return Operator;
 }
 
-^{reserved} { return Keyword; }
 <First>{
 	[[:blank:]]+ { return Normal; }
 	{reserved} {