aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/lexer.tes
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2014-11-20 01:31:24 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2014-11-20 01:31:24 +0100
commitc80c632ed2e844a66207da5fb462960ecca219f5 (patch)
tree820c0cb5549cde5079951cfbb19ede3a7dcdf65d /lib/lexer.tes
parent4282e7d6b2f2cd73e93bf478a4aae4ce92481808 (diff)
downloadsciteco-c80c632ed2e844a66207da5fb462960ecca219f5.tar.gz
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/lexer.tes')
-rw-r--r--lib/lexer.tes19
1 files changed, 14 insertions, 5 deletions
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!