diff options
| author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-20 01:31:24 +0100 |
|---|---|---|
| committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-20 01:31:24 +0100 |
| commit | c80c632ed2e844a66207da5fb462960ecca219f5 (patch) | |
| tree | 820c0cb5549cde5079951cfbb19ede3a7dcdf65d /lib/lexers/sh.tes | |
| parent | 4282e7d6b2f2cd73e93bf478a4aae4ce92481808 (diff) | |
lexer library: added M[lexer.checkheader] and M[lexer.checkname] for matching a pattern
against the first line of a buffer or its filename.
This simplifies the "lexer.test..." macros and allows us to
select lexers based on the #! line.
Diffstat (limited to 'lib/lexers/sh.tes')
| -rw-r--r-- | lib/lexers/sh.tes | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/lexers/sh.tes b/lib/lexers/sh.tes index 79bdd8e..7d4f14c 100644 --- a/lib/lexers/sh.tes +++ b/lib/lexers/sh.tes @@ -1,8 +1,11 @@ ! Unix Shell ! @[lexer.test.sh]{ [_ - :S[.sh,.bsh,configure,.ksh] - ! TODO: test hash-bang line ! + _#!M[sh,bash,ksh]M[lexer.checkheader]"S + -1 + | + _[.sh,.bsh,configure,.ksh]M[lexer.checkname] + ' ]_ } @[lexer.set.sh]{ @@ -47,5 +50,5 @@ } @:[lexer.auto]{ - :M[lexer.test.sh]"S Q.fEB :M[lexer.set.sh] Oend ' + :M[lexer.test.sh]"S :M[lexer.set.sh] Oend ' } |
