From dba506c3818481d3b1352ade6055abfdd918e1ec Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 26 Jan 2021 21:11:36 -0500 Subject: Use First state to match keyword at beginning of line Otherwise keywords at the beginnings of lines with preceeding whitespace are not matched. --- bin/sh.l | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/sh.l b/bin/sh.l index 77dd2518..fcd5ce35 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; } { [[:blank:]]+ { return Normal; } {reserved} { -- cgit 1.4.1