From c80c632ed2e844a66207da5fb462960ecca219f5 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 20 Nov 2014 01:31:24 +0100 Subject: 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. --- lib/lexer.tes | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/lexer.tes') diff --git a/lib/lexer.tes b/lib/lexer.tes index de73d5c..01c3bf1 100644 --- a/lib/lexer.tes +++ b/lib/lexer.tes @@ -1,11 +1,22 @@ ! Lexer configuration and styles (ED hook) ! +! Match Q-Reg "_" against beginning of current doc's first line ! +@[lexer.checkheader]{ + .h + 0,0,1ESPOSITIONFROMLINE:X.h + EQ.h :SQ_ Q*EB +} + +! Match Q-Reg "_" against end of current doc's file name ! +@[lexer.checkname]{ + EQ* ZJ I H:SQ_ + Q*EB +} + @[lexer.auto]{ ! Set up brace lightning ! :M[color.bracelight],34M[color.set] :M[color.error],35M[color.set] - - Q*U.f EQ* HX.f :.f EQ.f } ! individual tests are appended by the lexers/*.tes files ! @@ -18,6 +29,4 @@ EMQ[$SCITECOPATH]/lexers/sh.tes EMQ[$SCITECOPATH]/lexers/xml.tes ! append an "end" label ! -@:[lexer.auto]{ - Q.fEB -!end!} +:[lexer.auto]!end! -- cgit v1.2.3