aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/scite2co.lua
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-05-25 22:02:31 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-05-25 22:02:31 +0200
commitbae8cd712c167522a95a093296453a54dde4a524 (patch)
tree1523fcf738c9dbd0b6d96222ccd693faa2938060 /lib/scite2co.lua
parent83f18d2578288fe71fca409e4f03434346b0d5b7 (diff)
downloadsciteco-bae8cd712c167522a95a093296453a54dde4a524.tar.gz
extended <EN> command and used it to optimize "lexer.test..." macros
* EN may now be used for matching file names (similar to fnmatch(3)). This is used to check the current buffers file extension in the lexer configuration macros instead of using expensive Q-Register manipulations. This halves the overall startup time - it is now acceptable even with the current amount of lexer configurations. * EN may now be used for checking file types. session.tes has been simplified. * BREAKS macro portability (EN now has 2 string arguments). * The Globber class has been extended to allow filtering of glob results by file type.
Diffstat (limited to 'lib/scite2co.lua')
-rwxr-xr-xlib/scite2co.lua25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/scite2co.lua b/lib/scite2co.lua
index 21d7c4d..c0e223a 100755
--- a/lib/scite2co.lua
+++ b/lib/scite2co.lua
@@ -90,22 +90,21 @@ io.write("! AUTO-GENERATED FROM SCITE PROPERTY SET !\n\n")
-- print [lexer.test...] macro
local shbang = expand(props["shbang."..language])
local file_patterns = expand(props["file.patterns."..language])
-local teco_patterns = file_patterns:gsub("%*%.", ""):gsub(";", ",")
-if teco_patterns:find(",", 1, true) then
- teco_patterns = "["..teco_patterns.."]"
-end
io.write([=[
-@[lexer.test.]=]..language:lower()..[=[]{ [_
-]=])
-if shbang then io.write([=[ _#!M]=]..shbang..[=[M[lexer.checkheader]"S
- -1
- |
- ]=]) end
-io.write([=[ _.]=]..teco_patterns..[=[M[lexer.checkname]
+@[lexer.test.]=]..language:lower()..[=[]{
]=])
-if shbang then io.write([=[ '
+if shbang then io.write([=[ _#!M]=]..shbang..[=[M[lexer.checkheader]U.r
]=]) end
-io.write([=[]_ }
+local first_pattern = not shbang
+for pattern in file_patterns:gmatch("[^;]+") do
+ io.write([=[ ]=])
+ if not first_pattern then io.write([=[Q.r"F ]=]) end
+ io.write([=[:EN]=]..pattern..[=[Q*U.r]=])
+ if not first_pattern then io.write([=[ ']=]) end
+ io.write("\n")
+ first_pattern = false
+end
+io.write([=[Q.r}
]=])