diff options
76 files changed, 582 insertions, 288 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index a9bc944..cdd2bb7 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -973,10 +973,12 @@ global registers: .TP 2 .BR _ " (underscore)" Search string and search condition register. +Also used by the globbing command \fBEN\fP, so it is also +the glob string and condition register. .TP .BR - " (minus)" Replacement string register. -Its integer part is unused. +Its integer part is currently unused. .TP .BR * " (asterisk)" File name (string part) and id (numeric part) of current diff --git a/lib/lexer.tes b/lib/lexer.tes index bf6b475..309c752 100644 --- a/lib/lexer.tes +++ b/lib/lexer.tes @@ -7,20 +7,17 @@ [* EQ.h :SQ_ ]* } -! Match Q-Reg "_" against end of current doc's file name ! -@[lexer.checkname]{ - [* EQ* ZJ I H:SQ_ ]* -} - @[lexer.auto]{ ! Set up brace lightning ! :M[color.bracelight],34M[color.set] :M[color.error],35M[color.set] + [_ } ! Automatically mung all the lexers and add them to "lexer.auto" ! [* - EQ.[lexers] ENQ[$SCITECOPATH]/lexers/*.tes J + EQ.[lexers] + [_ 1ENQ[$SCITECOPATH]/lexers/*.tes ]_ J <:L;R 0X.[filename] 4R .U.p <-A-^^/"= 1; ':R;> .,Q.pX.[name] EMQ.[filename] @@ -31,4 +28,6 @@ ]* ! append "end" label to "lexer.auto" ! -:[lexer.auto]!end! +:@[lexer.auto]{ + !end! ]_ +} diff --git a/lib/lexers/abaqus.tes b/lib/lexers/abaqus.tes index a85a4fb..d3facee 100644 --- a/lib/lexers/abaqus.tes +++ b/lib/lexers/abaqus.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.abaqus]{ [_ - _.[inp,dat,msg]M[lexer.checkname] -]_ } +@[lexer.test.abaqus]{ + :EN*.inpQ*U.r + Q.r"F :EN*.datQ*U.r ' + Q.r"F :EN*.msgQ*U.r ' +Q.r} @[lexer.set.abaqus]{ ESSETLEXER,SCLEX_ABAQUS diff --git a/lib/lexers/ada.tes b/lib/lexers/ada.tes index 2bdea8b..52f2673 100644 --- a/lib/lexers/ada.tes +++ b/lib/lexers/ada.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.ada]{ [_ - _.[ads,adb]M[lexer.checkname] -]_ } +@[lexer.test.ada]{ + :EN*.adsQ*U.r + Q.r"F :EN*.adbQ*U.r ' +Q.r} @[lexer.set.ada]{ ESSETLEXER,SCLEX_ADA diff --git a/lib/lexers/asl.tes b/lib/lexers/asl.tes index 96ccc23..e47b0cf 100644 --- a/lib/lexers/asl.tes +++ b/lib/lexers/asl.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.asl]{ [_ - _.[asl,dsl]M[lexer.checkname] -]_ } +@[lexer.test.asl]{ + :EN*.aslQ*U.r + Q.r"F :EN*.dslQ*U.r ' +Q.r} @[lexer.set.asl]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/asm.tes b/lib/lexers/asm.tes index e63f773..6bd5346 100644 --- a/lib/lexers/asm.tes +++ b/lib/lexers/asm.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.asm]{ [_ - _.asmM[lexer.checkname] -]_ } +@[lexer.test.asm]{ + :EN*.asmQ* +} @[lexer.set.asm]{ ESSETLEXER,SCLEX_ASM diff --git a/lib/lexers/ave.tes b/lib/lexers/ave.tes index 6ee8730..3b80236 100644 --- a/lib/lexers/ave.tes +++ b/lib/lexers/ave.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.ave]{ [_ - _.aveM[lexer.checkname] -]_ } +@[lexer.test.ave]{ + :EN*.aveQ* +} @[lexer.set.ave]{ ESSETLEXER,SCLEX_AVE diff --git a/lib/lexers/avs.tes b/lib/lexers/avs.tes index 11cf442..de4ec70 100644 --- a/lib/lexers/avs.tes +++ b/lib/lexers/avs.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.avs]{ [_ - _.[avs,avsi]M[lexer.checkname] -]_ } +@[lexer.test.avs]{ + :EN*.avsQ*U.r + Q.r"F :EN*.avsiQ*U.r ' +Q.r} @[lexer.set.avs]{ ESSETLEXER,SCLEX_AVS diff --git a/lib/lexers/awk.tes b/lib/lexers/awk.tes index e9b98a0..e069508 100644 --- a/lib/lexers/awk.tes +++ b/lib/lexers/awk.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.awk]{ [_ - _.awkM[lexer.checkname] -]_ } +@[lexer.test.awk]{ + :EN*.awkQ* +} @[lexer.set.awk]{ ESSETLEXER,SCLEX_PERL diff --git a/lib/lexers/baan.tes b/lib/lexers/baan.tes index 522d779..a005bfc 100644 --- a/lib/lexers/baan.tes +++ b/lib/lexers/baan.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.baan]{ [_ - _.[bc,cln]M[lexer.checkname] -]_ } +@[lexer.test.baan]{ + :EN*.bcQ*U.r + Q.r"F :EN*.clnQ*U.r ' +Q.r} @[lexer.set.baan]{ ESSETLEXER,SCLEX_BAAN diff --git a/lib/lexers/bash.tes b/lib/lexers/bash.tes index 80a3bbb..33cab3a 100644 --- a/lib/lexers/bash.tes +++ b/lib/lexers/bash.tes @@ -2,13 +2,13 @@ It's called bash.tes only because SciTE calls it this way internally ! -@[lexer.test.bash]{ [_ - _#!M[sh,bash,ksh]M[lexer.checkheader]"S - -1 - | - _[.sh,.bsh,configure,.ksh]M[lexer.checkname] - ' -]_ } +@[lexer.test.bash]{ + _#!M[sh,bash,ksh]M[lexer.checkheader]U.r + Q.r"F :EN*.shQ*U.r ' + Q.r"F :EN*.bshQ*U.r ' + Q.r"F :EN*/configureQ*U.r ' + Q.r"F :EN*.kshQ*U.r ' +Q.r} @[lexer.set.bash]{ ESSETLEXER,SCLEX_BASH diff --git a/lib/lexers/batch.tes b/lib/lexers/batch.tes index 09c8649..c8b8100 100644 --- a/lib/lexers/batch.tes +++ b/lib/lexers/batch.tes @@ -1,8 +1,10 @@ ! DOS, Windows, OS/2 Batch Files ! -@[lexer.test.batch]{ [_ - _.[bat,cmd,nt]M[lexer.checkname] -]_ } +@[lexer.test.batch]{ + :EN*.batQ*U.r + Q.r"F :EN*.cmdQ*U.r ' + Q.r"F :EN*.ntQ*U.r ' +Q.r} @[lexer.set.batch]{ ESSETLEXER,SCLEX_BATCH diff --git a/lib/lexers/blitzbasic.tes b/lib/lexers/blitzbasic.tes index 618661c..e815473 100644 --- a/lib/lexers/blitzbasic.tes +++ b/lib/lexers/blitzbasic.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.blitzbasic]{ [_ - _.bbM[lexer.checkname] -]_ } +@[lexer.test.blitzbasic]{ + :EN*.bbQ* +} @[lexer.set.blitzbasic]{ ESSETLEXER,SCLEX_BLITZBASIC diff --git a/lib/lexers/caml.tes b/lib/lexers/caml.tes index f9827e2..13026cb 100644 --- a/lib/lexers/caml.tes +++ b/lib/lexers/caml.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.caml]{ [_ - _.[ml,mli]M[lexer.checkname] -]_ } +@[lexer.test.caml]{ + :EN*.mlQ*U.r + Q.r"F :EN*.mliQ*U.r ' +Q.r} @[lexer.set.caml]{ ESSETLEXER,SCLEX_CAML diff --git a/lib/lexers/ch.tes b/lib/lexers/ch.tes index f7046c7..560c947 100644 --- a/lib/lexers/ch.tes +++ b/lib/lexers/ch.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.ch]{ [_ - _.[ch,chf,chs]M[lexer.checkname] -]_ } +@[lexer.test.ch]{ + :EN*.chQ*U.r + Q.r"F :EN*.chfQ*U.r ' + Q.r"F :EN*.chsQ*U.r ' +Q.r} @[lexer.set.ch]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/cmake.tes b/lib/lexers/cmake.tes index b6028bc..feb32e8 100644 --- a/lib/lexers/cmake.tes +++ b/lib/lexers/cmake.tes @@ -1,8 +1,10 @@ ! CMake Lexing ! -@[lexer.test.cmake]{ [_ - _[CMakeLists.txt,.cmake,.cmake.in,.ctest,.ctest.in]M[lexer.checkname] -]_ } +@[lexer.test.cmake]{ + :EN*/CMakeLists.txtQ*U.r + Q.r"F :EN*.cmake*Q*U.r ' + Q.r"F :EN*.ctest*Q*U.r ' +Q.r} @[lexer.set.cmake]{ ESSETLEXER,SCLEX_CMAKE diff --git a/lib/lexers/cobol.tes b/lib/lexers/cobol.tes index f54ccc9..4be4a0a 100644 --- a/lib/lexers/cobol.tes +++ b/lib/lexers/cobol.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.cobol]{ [_ - _.cobM[lexer.checkname] -]_ } +@[lexer.test.cobol]{ + :EN*.cobQ* +} @[lexer.set.cobol]{ ESSETLEXER,SCLEX_COBOL diff --git a/lib/lexers/cpp.tes b/lib/lexers/cpp.tes index a080c7c..6a77c95 100644 --- a/lib/lexers/cpp.tes +++ b/lib/lexers/cpp.tes @@ -1,8 +1,19 @@ ! C/C++ Lexing ! -@[lexer.test.cpp]{ [_ - _.[c,cc,cpp,cxx,h,hh,hpp,hxx,ipp,m,mm,sma]M[lexer.checkname] -]_ } +@[lexer.test.cpp]{ + :EN*.cQ*U.r + Q.r"F :EN*.ccQ*U.r ' + Q.r"F :EN*.cppQ*U.r ' + Q.r"F :EN*.cxxQ*U.r ' + Q.r"F :EN*.hQ*U.r ' + Q.r"F :EN*.hhQ*U.r ' + Q.r"F :EN*.hppQ*U.r ' + Q.r"F :EN*.hxxQ*U.r ' + Q.r"F :EN*.ippQ*U.r ' + Q.r"F :EN*.mQ*U.r ' + Q.r"F :EN*.mmQ*U.r ' + Q.r"F :EN*.smaQ*U.r ' +Q.r} @[lexer.set.cpp]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/cs.tes b/lib/lexers/cs.tes index 8121c97..6b3ae4a 100644 --- a/lib/lexers/cs.tes +++ b/lib/lexers/cs.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.cs]{ [_ - _.csM[lexer.checkname] -]_ } +@[lexer.test.cs]{ + :EN*.csQ* +} @[lexer.set.cs]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/d.tes b/lib/lexers/d.tes index 5ca421d..1f102f0 100644 --- a/lib/lexers/d.tes +++ b/lib/lexers/d.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.d]{ [_ - _.dM[lexer.checkname] -]_ } +@[lexer.test.d]{ + :EN*.dQ* +} @[lexer.set.d]{ ESSETLEXER,SCLEX_D diff --git a/lib/lexers/diff.tes b/lib/lexers/diff.tes index fb1af2b..cd01708 100644 --- a/lib/lexers/diff.tes +++ b/lib/lexers/diff.tes @@ -1,8 +1,9 @@ ! Patch/Diff Files ! -@[lexer.test.diff]{ [_ - _.[diff,patch]M[lexer.checkname] -]_ } +@[lexer.test.diff]{ + :EN*.diffQ*U.r + Q.r"F :EN*.patchQ*U.r ' +Q.r} @[lexer.set.diff]{ ESSETLEXER,SCLEX_DIFF diff --git a/lib/lexers/docbook.tes b/lib/lexers/docbook.tes index 58e0988..6417f76 100644 --- a/lib/lexers/docbook.tes +++ b/lib/lexers/docbook.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.docbook]{ [_ - _.docbookM[lexer.checkname] -]_ } +@[lexer.test.docbook]{ + :EN*.docbookQ* +} @[lexer.set.docbook]{ ESSETLEXER,SCLEX_HYPERTEXT diff --git a/lib/lexers/eiffel.tes b/lib/lexers/eiffel.tes index aa53ae3..8277a10 100644 --- a/lib/lexers/eiffel.tes +++ b/lib/lexers/eiffel.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.eiffel]{ [_ - _.eM[lexer.checkname] -]_ } +@[lexer.test.eiffel]{ + :EN*.eQ* +} @[lexer.set.eiffel]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/f77.tes b/lib/lexers/f77.tes index 9599090..c0d2fca 100644 --- a/lib/lexers/f77.tes +++ b/lib/lexers/f77.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.f77]{ [_ - _.[f,for]M[lexer.checkname] -]_ } +@[lexer.test.f77]{ + :EN*.fQ*U.r + Q.r"F :EN*.forQ*U.r ' +Q.r} @[lexer.set.f77]{ ESSETLEXER,SCLEX_F77 diff --git a/lib/lexers/f95.tes b/lib/lexers/f95.tes index 0b4bba1..dbd60f9 100644 --- a/lib/lexers/f95.tes +++ b/lib/lexers/f95.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.f95]{ [_ - _.[f90,f95,f2k]M[lexer.checkname] -]_ } +@[lexer.test.f95]{ + :EN*.f90Q*U.r + Q.r"F :EN*.f95Q*U.r ' + Q.r"F :EN*.f2kQ*U.r ' +Q.r} @[lexer.set.f95]{ ESSETLEXER,SCLEX_FORTRAN diff --git a/lib/lexers/flagship.tes b/lib/lexers/flagship.tes index bb79439..a3de658 100644 --- a/lib/lexers/flagship.tes +++ b/lib/lexers/flagship.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.flagship]{ [_ - _.prgM[lexer.checkname] -]_ } +@[lexer.test.flagship]{ + :EN*.prgQ* +} @[lexer.set.flagship]{ ESSETLEXER,SCLEX_FLAGSHIP diff --git a/lib/lexers/flash.tes b/lib/lexers/flash.tes index b039219..7924394 100644 --- a/lib/lexers/flash.tes +++ b/lib/lexers/flash.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.flash]{ [_ - _.[as,asc,jsfl]M[lexer.checkname] -]_ } +@[lexer.test.flash]{ + :EN*.asQ*U.r + Q.r"F :EN*.ascQ*U.r ' + Q.r"F :EN*.jsflQ*U.r ' +Q.r} @[lexer.set.flash]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/freebasic.tes b/lib/lexers/freebasic.tes index 12e0263..471309a 100644 --- a/lib/lexers/freebasic.tes +++ b/lib/lexers/freebasic.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.freebasic]{ [_ - _.[bas,bi]M[lexer.checkname] -]_ } +@[lexer.test.freebasic]{ + :EN*.basQ*U.r + Q.r"F :EN*.biQ*U.r ' +Q.r} @[lexer.set.freebasic]{ ESSETLEXER,SCLEX_FREEBASIC diff --git a/lib/lexers/gap.tes b/lib/lexers/gap.tes index affa2ea..9e85e36 100644 --- a/lib/lexers/gap.tes +++ b/lib/lexers/gap.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.gap]{ [_ - _.[g,gd,gi]M[lexer.checkname] -]_ } +@[lexer.test.gap]{ + :EN*.gQ*U.r + Q.r"F :EN*.gdQ*U.r ' + Q.r"F :EN*.giQ*U.r ' +Q.r} @[lexer.set.gap]{ ESSETLEXER,SCLEX_GAP diff --git a/lib/lexers/go.tes b/lib/lexers/go.tes index 8ae0826..2b2eaef 100644 --- a/lib/lexers/go.tes +++ b/lib/lexers/go.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.go]{ [_ - _.goM[lexer.checkname] -]_ } +@[lexer.test.go]{ + :EN*.goQ* +} @[lexer.set.go]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/html.tes b/lib/lexers/html.tes index e3bde6a..ddc6764 100644 --- a/lib/lexers/html.tes +++ b/lib/lexers/html.tes @@ -1,8 +1,22 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.html]{ [_ - _.[html,htm,asp,shtml,htd,jsp,xhtml,php3,phtml,php,htt,cfm,tpl,dtd,hta]M[lexer.checkname] -]_ } +@[lexer.test.html]{ + :EN*.htmlQ*U.r + Q.r"F :EN*.htmQ*U.r ' + Q.r"F :EN*.aspQ*U.r ' + Q.r"F :EN*.shtmlQ*U.r ' + Q.r"F :EN*.htdQ*U.r ' + Q.r"F :EN*.jspQ*U.r ' + Q.r"F :EN*.xhtmlQ*U.r ' + Q.r"F :EN*.php3Q*U.r ' + Q.r"F :EN*.phtmlQ*U.r ' + Q.r"F :EN*.phpQ*U.r ' + Q.r"F :EN*.httQ*U.r ' + Q.r"F :EN*.cfmQ*U.r ' + Q.r"F :EN*.tplQ*U.r ' + Q.r"F :EN*.dtdQ*U.r ' + Q.r"F :EN*.htaQ*U.r ' +Q.r} @[lexer.set.html]{ ESSETLEXER,SCLEX_HYPERTEXT diff --git a/lib/lexers/idl.tes b/lib/lexers/idl.tes index 9a469b5..3b7d25a 100644 --- a/lib/lexers/idl.tes +++ b/lib/lexers/idl.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.idl]{ [_ - _.[idl,odl]M[lexer.checkname] -]_ } +@[lexer.test.idl]{ + :EN*.idlQ*U.r + Q.r"F :EN*.odlQ*U.r ' +Q.r} @[lexer.set.idl]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/inno.tes b/lib/lexers/inno.tes index 313e78c..1ac95fb 100644 --- a/lib/lexers/inno.tes +++ b/lib/lexers/inno.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.inno]{ [_ - _.[iss,isl]M[lexer.checkname] -]_ } +@[lexer.test.inno]{ + :EN*.issQ*U.r + Q.r"F :EN*.islQ*U.r ' +Q.r} @[lexer.set.inno]{ ESSETLEXER,SCLEX_INNO diff --git a/lib/lexers/java.tes b/lib/lexers/java.tes index 188c5b6..968631a 100644 --- a/lib/lexers/java.tes +++ b/lib/lexers/java.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.java]{ [_ - _.[java,jad,pde]M[lexer.checkname] -]_ } +@[lexer.test.java]{ + :EN*.javaQ*U.r + Q.r"F :EN*.jadQ*U.r ' + Q.r"F :EN*.pdeQ*U.r ' +Q.r} @[lexer.set.java]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/js.tes b/lib/lexers/js.tes index 50953af..650935c 100644 --- a/lib/lexers/js.tes +++ b/lib/lexers/js.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.js]{ [_ - _.[js,es,json]M[lexer.checkname] -]_ } +@[lexer.test.js]{ + :EN*.jsQ*U.r + Q.r"F :EN*.esQ*U.r ' + Q.r"F :EN*.jsonQ*U.r ' +Q.r} @[lexer.set.js]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/kix.tes b/lib/lexers/kix.tes index 42f39c6..a605219 100644 --- a/lib/lexers/kix.tes +++ b/lib/lexers/kix.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.kix]{ [_ - _.kixM[lexer.checkname] -]_ } +@[lexer.test.kix]{ + :EN*.kixQ* +} @[lexer.set.kix]{ ESSETLEXER,SCLEX_KIX diff --git a/lib/lexers/lisp.tes b/lib/lexers/lisp.tes index ef66f18..1b4f1dd 100644 --- a/lib/lexers/lisp.tes +++ b/lib/lexers/lisp.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.lisp]{ [_ - _.[lsp,lisp]M[lexer.checkname] -]_ } +@[lexer.test.lisp]{ + :EN*.lspQ*U.r + Q.r"F :EN*.lispQ*U.r ' +Q.r} @[lexer.set.lisp]{ ESSETLEXER,SCLEX_LISP diff --git a/lib/lexers/lout.tes b/lib/lexers/lout.tes index 431e5ef..1121a10 100644 --- a/lib/lexers/lout.tes +++ b/lib/lexers/lout.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.lout]{ [_ - _.ltM[lexer.checkname] -]_ } +@[lexer.test.lout]{ + :EN*.ltQ* +} @[lexer.set.lout]{ ESSETLEXER,SCLEX_LOUT diff --git a/lib/lexers/lua.tes b/lib/lexers/lua.tes index 4e24315..9278557 100644 --- a/lib/lexers/lua.tes +++ b/lib/lexers/lua.tes @@ -1,12 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.lua]{ [_ - _#!M[lua,lua5.1,lua5.2]M[lexer.checkheader]"S - -1 - | - _.luaM[lexer.checkname] - ' -]_ } +@[lexer.test.lua]{ + _#!M[lua,lua5.1,lua5.2]M[lexer.checkheader]U.r + Q.r"F :EN*.luaQ*U.r ' +Q.r} @[lexer.set.lua]{ ESSETLEXER,SCLEX_LUA diff --git a/lib/lexers/make.tes b/lib/lexers/make.tes index bf7a973..aa5bbe6 100644 --- a/lib/lexers/make.tes +++ b/lib/lexers/make.tes @@ -1,8 +1,10 @@ ! Makefile Lexing ! @[lexer.test.make]{ - [_ _[makefile,.mak]M[lexer.checkname] ]_ -} + :EN*/MakefileQ*U.r + Q.r"F :EN*/makefileQ*U.r ' + Q.r"F :EN*.makQ*U.r ' +Q.r} @[lexer.set.make]{ ESSETLEXER,SCLEX_MAKEFILE diff --git a/lib/lexers/mako.tes b/lib/lexers/mako.tes index 30accbe..9ae9d25 100644 --- a/lib/lexers/mako.tes +++ b/lib/lexers/mako.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.mako]{ [_ - _.[mak,mako]M[lexer.checkname] -]_ } +@[lexer.test.mako]{ + :EN*.makQ*U.r + Q.r"F :EN*.makoQ*U.r ' +Q.r} @[lexer.set.mako]{ ESSETLEXER,SCLEX_HYPERTEXT diff --git a/lib/lexers/matlab.tes b/lib/lexers/matlab.tes index 8aafcc3..d2d8bcc 100644 --- a/lib/lexers/matlab.tes +++ b/lib/lexers/matlab.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.matlab]{ [_ - _.m.matlabM[lexer.checkname] -]_ } +@[lexer.test.matlab]{ + :EN*.m.matlabQ* +} @[lexer.set.matlab]{ ESSETLEXER,SCLEX_MATLAB diff --git a/lib/lexers/mmixal.tes b/lib/lexers/mmixal.tes index 1de8986..c801670 100644 --- a/lib/lexers/mmixal.tes +++ b/lib/lexers/mmixal.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.mmixal]{ [_ - _.mmsM[lexer.checkname] -]_ } +@[lexer.test.mmixal]{ + :EN*.mmsQ* +} @[lexer.set.mmixal]{ ESSETLEXER,SCLEX_MMIXAL diff --git a/lib/lexers/octave.tes b/lib/lexers/octave.tes index 9b0131f..0fa3569 100644 --- a/lib/lexers/octave.tes +++ b/lib/lexers/octave.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.octave]{ [_ - _.m.octaveM[lexer.checkname] -]_ } +@[lexer.test.octave]{ + :EN*.m.octaveQ* +} @[lexer.set.octave]{ ESSETLEXER,SCLEX_OCTAVE diff --git a/lib/lexers/oscript.tes b/lib/lexers/oscript.tes index e0839bd..3bbf8b7 100644 --- a/lib/lexers/oscript.tes +++ b/lib/lexers/oscript.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.oscript]{ [_ - _.osxM[lexer.checkname] -]_ } +@[lexer.test.oscript]{ + :EN*.osxQ* +} @[lexer.set.oscript]{ ESSETLEXER,SCLEX_OSCRIPT diff --git a/lib/lexers/pascal.tes b/lib/lexers/pascal.tes index 9373c73..e1323fa 100644 --- a/lib/lexers/pascal.tes +++ b/lib/lexers/pascal.tes @@ -1,8 +1,12 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.pascal]{ [_ - _.[dpr,pas,dfm,inc,pp]M[lexer.checkname] -]_ } +@[lexer.test.pascal]{ + :EN*.dprQ*U.r + Q.r"F :EN*.pasQ*U.r ' + Q.r"F :EN*.dfmQ*U.r ' + Q.r"F :EN*.incQ*U.r ' + Q.r"F :EN*.ppQ*U.r ' +Q.r} @[lexer.set.pascal]{ ESSETLEXER,SCLEX_PASCAL diff --git a/lib/lexers/perl.tes b/lib/lexers/perl.tes index ea11fbf..a7d04ee 100644 --- a/lib/lexers/perl.tes +++ b/lib/lexers/perl.tes @@ -1,12 +1,11 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.perl]{ [_ - _#!M[perl,pl]M[lexer.checkheader]"S - -1 - | - _.[pl,pm,pod]M[lexer.checkname] - ' -]_ } +@[lexer.test.perl]{ + _#!M[perl,pl]M[lexer.checkheader]U.r + Q.r"F :EN*.plQ*U.r ' + Q.r"F :EN*.pmQ*U.r ' + Q.r"F :EN*.podQ*U.r ' +Q.r} @[lexer.set.perl]{ ESSETLEXER,SCLEX_PERL diff --git a/lib/lexers/php.tes b/lib/lexers/php.tes index dde8119..f20efb7 100644 --- a/lib/lexers/php.tes +++ b/lib/lexers/php.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.php]{ [_ - _.[php3,phtml,php]M[lexer.checkname] -]_ } +@[lexer.test.php]{ + :EN*.php3Q*U.r + Q.r"F :EN*.phtmlQ*U.r ' + Q.r"F :EN*.phpQ*U.r ' +Q.r} @[lexer.set.php]{ ESSETLEXER,SCLEX_HYPERTEXT diff --git a/lib/lexers/pike.tes b/lib/lexers/pike.tes index 29044f4..eee474f 100644 --- a/lib/lexers/pike.tes +++ b/lib/lexers/pike.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.pike]{ [_ - _.pikeM[lexer.checkname] -]_ } +@[lexer.test.pike]{ + :EN*.pikeQ* +} @[lexer.set.pike]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/pov.tes b/lib/lexers/pov.tes index f8b3d37..93d8bec 100644 --- a/lib/lexers/pov.tes +++ b/lib/lexers/pov.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.pov]{ [_ - _.[pov,inc]M[lexer.checkname] -]_ } +@[lexer.test.pov]{ + :EN*.povQ*U.r + Q.r"F :EN*.incQ*U.r ' +Q.r} @[lexer.set.pov]{ ESSETLEXER,SCLEX_POV diff --git a/lib/lexers/powerpro.tes b/lib/lexers/powerpro.tes index d0a7407..b4fa29f 100644 --- a/lib/lexers/powerpro.tes +++ b/lib/lexers/powerpro.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.powerpro]{ [_ - _.powerproM[lexer.checkname] -]_ } +@[lexer.test.powerpro]{ + :EN*.powerproQ* +} @[lexer.set.powerpro]{ ESSETLEXER,SCLEX_POWERPRO diff --git a/lib/lexers/purebasic.tes b/lib/lexers/purebasic.tes index c6ad766..6c220b9 100644 --- a/lib/lexers/purebasic.tes +++ b/lib/lexers/purebasic.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.purebasic]{ [_ - _.pbM[lexer.checkname] -]_ } +@[lexer.test.purebasic]{ + :EN*.pbQ* +} @[lexer.set.purebasic]{ ESSETLEXER,SCLEX_PUREBASIC diff --git a/lib/lexers/r.tes b/lib/lexers/r.tes index c90384c..0889d27 100644 --- a/lib/lexers/r.tes +++ b/lib/lexers/r.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.r]{ [_ - _.[R,rsource,S]M[lexer.checkname] -]_ } +@[lexer.test.r]{ + :EN*.RQ*U.r + Q.r"F :EN*.rsourceQ*U.r ' + Q.r"F :EN*.SQ*U.r ' +Q.r} @[lexer.set.r]{ ESSETLEXER,SCLEX_R diff --git a/lib/lexers/rc.tes b/lib/lexers/rc.tes index bddb84f..077e3df 100644 --- a/lib/lexers/rc.tes +++ b/lib/lexers/rc.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.rc]{ [_ - _.[rc,rc2,dlg]M[lexer.checkname] -]_ } +@[lexer.test.rc]{ + :EN*.rcQ*U.r + Q.r"F :EN*.rc2Q*U.r ' + Q.r"F :EN*.dlgQ*U.r ' +Q.r} @[lexer.set.rc]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/rebol.tes b/lib/lexers/rebol.tes index cf3105d..ac75d03 100644 --- a/lib/lexers/rebol.tes +++ b/lib/lexers/rebol.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.rebol]{ [_ - _.[r,reb]M[lexer.checkname] -]_ } +@[lexer.test.rebol]{ + :EN*.rQ*U.r + Q.r"F :EN*.rebQ*U.r ' +Q.r} @[lexer.set.rebol]{ ESSETLEXER,SCLEX_REBOL diff --git a/lib/lexers/rust.tes b/lib/lexers/rust.tes index c0d9497..ada1907 100644 --- a/lib/lexers/rust.tes +++ b/lib/lexers/rust.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.rust]{ [_ - _.rsM[lexer.checkname] -]_ } +@[lexer.test.rust]{ + :EN*.rsQ* +} @[lexer.set.rust]{ ESSETLEXER,SCLEX_RUST diff --git a/lib/lexers/scheme.tes b/lib/lexers/scheme.tes index 5ad6db6..d1c2b3e 100644 --- a/lib/lexers/scheme.tes +++ b/lib/lexers/scheme.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.scheme]{ [_ - _.[scm,smd,ss]M[lexer.checkname] -]_ } +@[lexer.test.scheme]{ + :EN*.scmQ*U.r + Q.r"F :EN*.smdQ*U.r ' + Q.r"F :EN*.ssQ*U.r ' +Q.r} @[lexer.set.scheme]{ ESSETLEXER,SCLEX_LISP diff --git a/lib/lexers/specman.tes b/lib/lexers/specman.tes index 1ffcec1..c33acf0 100644 --- a/lib/lexers/specman.tes +++ b/lib/lexers/specman.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.specman]{ [_ - _.eM[lexer.checkname] -]_ } +@[lexer.test.specman]{ + :EN*.eQ* +} @[lexer.set.specman]{ ESSETLEXER,SCLEX_EIFFEL diff --git a/lib/lexers/spice.tes b/lib/lexers/spice.tes index 6a702af..ae909bf 100644 --- a/lib/lexers/spice.tes +++ b/lib/lexers/spice.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.spice]{ [_ - _.[scp,out]M[lexer.checkname] -]_ } +@[lexer.test.spice]{ + :EN*.scpQ*U.r + Q.r"F :EN*.outQ*U.r ' +Q.r} @[lexer.set.spice]{ ESSETLEXER,SCLEX_SPICE diff --git a/lib/lexers/swift.tes b/lib/lexers/swift.tes index cb6a42d..5abc8ca 100644 --- a/lib/lexers/swift.tes +++ b/lib/lexers/swift.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.swift]{ [_ - _.swiftM[lexer.checkname] -]_ } +@[lexer.test.swift]{ + :EN*.swiftQ* +} @[lexer.set.swift]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/systemverilog.tes b/lib/lexers/systemverilog.tes index 04a4a35..9e5c696 100644 --- a/lib/lexers/systemverilog.tes +++ b/lib/lexers/systemverilog.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.systemverilog]{ [_ - _.[sv,svh]M[lexer.checkname] -]_ } +@[lexer.test.systemverilog]{ + :EN*.svQ*U.r + Q.r"F :EN*.svhQ*U.r ' +Q.r} @[lexer.set.systemverilog]{ ESSETLEXER,SCLEX_VERILOG diff --git a/lib/lexers/tacl.tes b/lib/lexers/tacl.tes index d51edef..13c975a 100644 --- a/lib/lexers/tacl.tes +++ b/lib/lexers/tacl.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.tacl]{ [_ - _.taclM[lexer.checkname] -]_ } +@[lexer.test.tacl]{ + :EN*.taclQ* +} @[lexer.set.tacl]{ ESSETLEXER,SCLEX_TACL diff --git a/lib/lexers/tal.tes b/lib/lexers/tal.tes index d292556..93ad688 100644 --- a/lib/lexers/tal.tes +++ b/lib/lexers/tal.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.tal]{ [_ - _.TALM[lexer.checkname] -]_ } +@[lexer.test.tal]{ + :EN*.talQ* +} @[lexer.set.tal]{ ESSETLEXER,SCLEX_TAL diff --git a/lib/lexers/tcl.tes b/lib/lexers/tcl.tes index a45acf7..dddae89 100644 --- a/lib/lexers/tcl.tes +++ b/lib/lexers/tcl.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.tcl]{ [_ - _.[tcl,exp]M[lexer.checkname] -]_ } +@[lexer.test.tcl]{ + :EN*.tclQ*U.r + Q.r"F :EN*.expQ*U.r ' +Q.r} @[lexer.set.tcl]{ ESSETLEXER,SCLEX_TCL diff --git a/lib/lexers/test.tes b/lib/lexers/test.tes index a2062da..48eb396 100644 --- a/lib/lexers/test.tes +++ b/lib/lexers/test.tes @@ -1,8 +1,10 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.test]{ [_ - _.[pln,inc,t]M[lexer.checkname] -]_ } +@[lexer.test.test]{ + :EN*.plnQ*U.r + Q.r"F :EN*.incQ*U.r ' + Q.r"F :EN*.tQ*U.r ' +Q.r} @[lexer.set.test]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/vala.tes b/lib/lexers/vala.tes index 7fcefaa..c78d079 100644 --- a/lib/lexers/vala.tes +++ b/lib/lexers/vala.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.vala]{ [_ - _.valaM[lexer.checkname] -]_ } +@[lexer.test.vala]{ + :EN*.valaQ* +} @[lexer.set.vala]{ ESSETLEXER,SCLEX_CPP diff --git a/lib/lexers/vb.tes b/lib/lexers/vb.tes index 8d5d8ec..18ffbe2 100644 --- a/lib/lexers/vb.tes +++ b/lib/lexers/vb.tes @@ -1,8 +1,15 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.vb]{ [_ - _.[vb,bas,frm,cls,ctl,pag,dsr,dob]M[lexer.checkname] -]_ } +@[lexer.test.vb]{ + :EN*.vbQ*U.r + Q.r"F :EN*.basQ*U.r ' + Q.r"F :EN*.frmQ*U.r ' + Q.r"F :EN*.clsQ*U.r ' + Q.r"F :EN*.ctlQ*U.r ' + Q.r"F :EN*.pagQ*U.r ' + Q.r"F :EN*.dsrQ*U.r ' + Q.r"F :EN*.dobQ*U.r ' +Q.r} @[lexer.set.vb]{ ESSETLEXER,SCLEX_VB diff --git a/lib/lexers/verilog.tes b/lib/lexers/verilog.tes index b964d60..4c5d99a 100644 --- a/lib/lexers/verilog.tes +++ b/lib/lexers/verilog.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.verilog]{ [_ - _.[v,vh]M[lexer.checkname] -]_ } +@[lexer.test.verilog]{ + :EN*.vQ*U.r + Q.r"F :EN*.vhQ*U.r ' +Q.r} @[lexer.set.verilog]{ ESSETLEXER,SCLEX_VERILOG diff --git a/lib/lexers/vhdl.tes b/lib/lexers/vhdl.tes index 1c64082..f382640 100644 --- a/lib/lexers/vhdl.tes +++ b/lib/lexers/vhdl.tes @@ -1,8 +1,9 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.vhdl]{ [_ - _.[vhd,vhdl]M[lexer.checkname] -]_ } +@[lexer.test.vhdl]{ + :EN*.vhdQ*U.r + Q.r"F :EN*.vhdlQ*U.r ' +Q.r} @[lexer.set.vhdl]{ ESSETLEXER,SCLEX_VHDL diff --git a/lib/lexers/vxml.tes b/lib/lexers/vxml.tes index 81e4066..74197ba 100644 --- a/lib/lexers/vxml.tes +++ b/lib/lexers/vxml.tes @@ -1,8 +1,8 @@ ! AUTO-GENERATED FROM SCITE PROPERTY SET ! -@[lexer.test.vxml]{ [_ - _.vxmlM[lexer.checkname] -]_ } +@[lexer.test.vxml]{ + :EN*.vxmlQ* +} @[lexer.set.vxml]{ ESSETLEXER,SCLEX_HYPERTEXT diff --git a/lib/lexers/xml.tes b/lib/lexers/xml.tes index ddb97df..92c02da 100644 --- a/lib/lexers/xml.tes +++ b/lib/lexers/xml.tes @@ -1,8 +1,17 @@ ! Lexing for XML and its applications ! -@[lexer.test.xml]{ [_ - _.[xml,xsl,svg,xul,xsd,dtd,xslt,axl,xrc,rdf]M[lexer.checkname] -]_ } +@[lexer.test.xml]{ + :EN*.xmlQ*U.r + Q.r"F :EN*.xslQ*U.r ' + Q.r"F :EN*.svgQ*U.r ' + Q.r"F :EN*.xulQ*U.r ' + Q.r"F :EN*.xsdQ*U.r ' + Q.r"F :EN*.dtdQ*U.r ' + Q.r"F :EN*.xsltQ*U.r ' + Q.r"F :EN*.axlQ*U.r ' + Q.r"F :EN*.xrcQ*U.r ' + Q.r"F :EN*.rdfQ*U.r ' +Q.r} @[lexer.set.xml]{ ESSETLEXER,SCLEX_XML 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} ]=]) diff --git a/lib/session.tes b/lib/session.tes index 697c350..09bd647 100644 --- a/lib/session.tes +++ b/lib/session.tes @@ -26,12 +26,11 @@ EU[session.path]Q[$SCITECOCONFIG]/.teco_session @[session.load]{ EJ<-EF> ! now we have only one unnamed buffer ! - EQ.x ENQ[session.path] - Z"= - 1EB - | - :EMQ[session.path] - ' + [_ + 1:EN*Q[session.path]"S + :EMQ[session.path] + ' + ]_ } ! Call this to set up the session path unique to the @@ -59,12 +58,12 @@ EU[session.path]Q[$SCITECOCONFIG]/.teco_session Requires the SVN client v1.7 or later in $PATH. ! @[session.svn]{ ! if there is no SVN working copy, session.path is left as it is ! - :EG.isvn info --xml"S [* + :EG.isvn info --xml"S [*[_ EQ.i :S<wcroot-abspath>"S .(S</.-2)X[session.path] :[session.path]/.teco_session ' - ]* ' + ]_]* ' } ! Call to set up the session path unique to the diff --git a/src/glob.cpp b/src/glob.cpp index 9ef3f89..66d6736 100644 --- a/src/glob.cpp +++ b/src/glob.cpp @@ -23,10 +23,13 @@ #include <glib.h> #include <glib/gprintf.h> +#include <glib/gstdio.h> #include "sciteco.h" #include "interface.h" #include "parser.h" +#include "expressions.h" +#include "qregisters.h" #include "ring.h" #include "ioview.h" #include "glob.h" @@ -34,10 +37,12 @@ namespace SciTECO { namespace States { - StateGlob glob; + StateGlob_pattern glob_pattern; + StateGlob_filename glob_filename; } -Globber::Globber(const gchar *pattern) +Globber::Globber(const gchar *pattern, GFileTest _test) + : test(_test) { gsize dirname_len; @@ -67,13 +72,27 @@ Globber::next(void) if (!dir) return NULL; - /* - * As dirname includes the directory separator, - * we can simply concatenate dirname with basename. - */ - while ((basename = g_dir_read_name(dir))) - if (g_pattern_match_string(pattern, basename)) - return g_strconcat(dirname, basename, NIL); + while ((basename = g_dir_read_name(dir))) { + gchar *filename; + + if (!g_pattern_match_string(pattern, basename)) + continue; + + /* + * As dirname includes the directory separator, + * we can simply concatenate dirname with basename. + */ + filename = g_strconcat(dirname, basename, NIL); + + /* + * No need to perform file test for EXISTS since + * g_dir_read_name() will only return existing entries + */ + if (test == G_FILE_TEST_EXISTS || g_file_test(filename, test)) + return filename; + + g_free(filename); + } return NULL; } @@ -92,32 +111,120 @@ Globber::~Globber() */ /*$ - * EN[pattern]$ -- Get list of files matching a glob pattern - * - * The EN command expands a glob \fIpattern\fP to a list of - * matching file names. This is similar to globbing - * on UNIX but not as powerful. - * The resulting file names have the exact same directory - * component as \fIpattern\fP (if any). + * [type]EN[pattern]$[filename]$ -- Glob files or match filename and check file type + * [type]:EN[pattern]$[filename]$ -> Success|Failure * + * EN is a powerful command for performing various tasks + * given a glob \fIpattern\fP. * A \fIpattern\fP is a file name with \(lq*\(rq and * \(lq?\(rq wildcards: * \(lq*\(rq matches an arbitrary, possibly empty, string. * \(lq?\(rq matches an arbitrary character. * - * EN will currently only match files in the file name component + * \fIpattern\fP may be omitted, in which case it defaults + * to the pattern saved in the search and glob register \(lq_\(rq. + * If it is specified, it overwrites the contents of the register + * \(lq_\(rq with \fIpattern\fP. + * This behaviour is similar to the search and replace commands + * and allows for repeated globbing/matching with the same + * pattern. + * Therefoe you should also save the \(lq_\(rq register on the + * Q-Register stack when calling EN from portable macros. + * + * If \fIfilename\fP is omitted (empty), EN may be used to expand + * a glob \fIpattern\fP to a list of matching file names. + * This is similar to globbing + * on UNIX but not as powerful and may be used e.g. for + * iterating over directory contents. + * E.g. \(lqEN*.c\fB$$\fP\(rq expands to all \(lq.c\(rq files + * in the current directory. + * The resulting file names have the exact same directory + * component as \fIpattern\fP (if any). + * Without \fIfilename\fP, EN will currently only match files + * in the file name component * of \fIpattern\fP, not on each component of the path name * separately. * In other words, EN only looks through the directory * of \fIpattern\fP \(em you cannot effectively match * multiple directories. * - * The result of the globbing is inserted into the current + * If \fIfilename\fP is specified, \fIpattern\fP will only + * be matched against that single file name. + * If it matches, \fIfilename\fP is used verbatim. + * In this form, \fIpattern\fP is matched against the entire + * file name, so it is possible to match directory components + * as well. + * \fIfilename\fP does not necessarily have to exist in the + * file system for the match to succeed (unless a file type check + * is also specified). + * For instance, \(lqENf??/\[**].c\fB$\fPfoo/bar.c\fB$\fP\(rq will + * always match and the string \(lqfoo/bar.c\(rq will be inserted + * (see below). + * + * By default, if EN is not colon-modified, the result of + * globbing or file name matching is inserted into the current * document, at the current position. * A linefeed is inserted after every file name, i.e. * every matching file will be on its own line. * - * String-building characters are enabled for EN. + * EN may be colon-modified to avoid any text insertion. + * Instead, a boolean is returned that signals whether + * any file matched \fIpattern\fP. + * E.g. \(lq:EN*.c\fB$$\fP\(rq returns success (-1) if + * there is at least one \(lq.c\(rq file in the current directory. + * + * The results of EN may be filtered by specifying a numeric file + * \fItype\fP check argument. + * This argument may be omitted (as in the examples above) and defaults + * to 0, i.e. no additional checking. + * The following file type check values are currently defined: + * .IP 0 4 + * No file type checking is performed. + * Note however, that when globbing only directory contents + * (of any type) are used, so without the \fIfilename\fP + * argument, the value 0 is equivalent to 5. + * .IP 1 + * Only match \fIregular files\fP (no directories). + * Will also match symlinks to regular files (on platforms + * supporting symlinks). + * .IP 2 + * Only match \fIsymlinks\fP. + * On platforms without symlinks (non-UNIX), this will never + * match anything. + * .IP 3 + * Only match \fIdirectories\fP. + * .IP 4 + * Only match \fIexecutables\fP. + * On UNIX, the executable flag is evaluated, while on + * Windows only the file name is checked. + * .IP 5 + * Only match existing files or directories. + * When globbing, this check makes no sense and is + * equivalent to no check at all. + * It may however be used to test that a filename refers + * to an existing file. + * + * For instance, \(lq3EN*\fB$$\fP\(rq will expand to + * all subdirectories in the current directory. + * The following idiom may be used to check whether + * a given filename refers to a regular file: + * 1:EN*\fB$\fIfilename\fB$\fR + * + * Note that both without colon and colon modified + * forms of EN save the success or failure of the + * operation in the numeric part of the glob register + * \(lq_\(rq (i.e. the same value that the colon modified + * form would return). + * The command itself never fails because of failure + * in matching any files. + * E.g. if \(lqEN*.c\fB$$\fP\(rq does not match any + * files, the EN command is still successful but does + * not insert anything. A failure boolean would be saved + * in \(lq_\(rq, though. + * + * String-building characters are enabled for EN and + * both string arguments are considered file names + * with regard to auto-completions. */ /* * NOTE: This does not work like classic TECO's @@ -131,43 +238,129 @@ Globber::~Globber() * have to edit that register anyway. */ State * -StateGlob::done(const gchar *str) +StateGlob_pattern::done(const gchar *str) +{ + BEGIN_EXEC(&States::glob_filename); + + if (*str) { + QRegister *glob_reg = QRegisters::globals["_"]; + + glob_reg->undo_set_string(); + glob_reg->set_string(str); + } + + return &States::glob_filename; +} + +State * +StateGlob_filename::done(const gchar *str) { BEGIN_EXEC(&States::start); - Globber globber(str); + tecoInt teco_test_mode; + GFileTest file_flags = G_FILE_TEST_EXISTS; + + bool matching = false; + bool colon_modified = eval_colon(); + + QRegister *glob_reg = QRegisters::globals["_"]; + gchar *pattern_str; - gchar *filename; - bool text_added = false; + expressions.eval(); + teco_test_mode = expressions.pop_num_calc(0, 0); + switch (teco_test_mode) { + /* + * 0 means, no file testing. + * file_flags will still be G_FILE_TEST_EXISTS which + * is equivalent to no testing when using the Globber class. + */ + case 0: break; + case 1: file_flags = G_FILE_TEST_IS_REGULAR; break; + case 2: file_flags = G_FILE_TEST_IS_SYMLINK; break; + case 3: file_flags = G_FILE_TEST_IS_DIR; break; + case 4: file_flags = G_FILE_TEST_IS_EXECUTABLE; break; + case 5: file_flags = G_FILE_TEST_EXISTS; break; + default: + throw Error("Invalid file test %" TECO_INTEGER_FORMAT + " for <EN>", teco_test_mode); + } - interface.ssm(SCI_BEGINUNDOACTION); + pattern_str = glob_reg->get_string(); - while ((filename = globber.next())) { - size_t len = strlen(filename); - /* overwrite trailing null */ - filename[len] = '\n'; + if (*str) { + /* + * Match pattern against provided file name + */ + if (g_pattern_match_simple(pattern_str, str) && + (!teco_test_mode || g_file_test(str, file_flags))) { + if (!colon_modified) { + interface.ssm(SCI_BEGINUNDOACTION); + interface.ssm(SCI_ADDTEXT, strlen(str), + (sptr_t)str); + interface.ssm(SCI_ADDTEXT, 1, (sptr_t)"\n"); + interface.ssm(SCI_SCROLLCARET); + interface.ssm(SCI_ENDUNDOACTION); + } + matching = true; + } + } else if (colon_modified) { /* - * FIXME: Once we're 8-bit clean, we should - * add the filenames null-terminated - * (there may be linebreaks in filename). + * Match pattern against directory contents (globbing), + * returning SUCCESS if at least one file matches */ - interface.ssm(SCI_ADDTEXT, len+1, - (sptr_t)filename); + Globber globber(pattern_str, file_flags); + gchar *filename = globber.next(); + + matching = filename != NULL; g_free(filename); - text_added = true; + } else { + /* + * Match pattern against directory contents (globbing), + * inserting all matching file names (linefeed-terminated) + */ + Globber globber(pattern_str, file_flags); + + gchar *filename; + + interface.ssm(SCI_BEGINUNDOACTION); + + while ((filename = globber.next())) { + size_t len = strlen(filename); + /* overwrite trailing null */ + filename[len] = '\n'; + + /* + * FIXME: Once we're 8-bit clean, we should + * add the filenames null-terminated + * (there may be linebreaks in filename). + */ + interface.ssm(SCI_ADDTEXT, len+1, + (sptr_t)filename); + + g_free(filename); + matching = true; + } + + interface.ssm(SCI_SCROLLCARET); + interface.ssm(SCI_ENDUNDOACTION); } - interface.ssm(SCI_SCROLLCARET); - interface.ssm(SCI_ENDUNDOACTION); + g_free(pattern_str); - if (text_added) { + if (colon_modified) { + expressions.push(TECO_BOOL(matching)); + } else if (matching) { + /* text has been inserted */ ring.dirtify(); if (current_doc_must_undo()) interface.undo_ssm(SCI_UNDO); } + glob_reg->undo_set_integer(); + glob_reg->set_integer(TECO_BOOL(matching)); + return &States::start; } @@ -21,6 +21,7 @@ #include <string.h> #include <glib.h> +#include <glib/gstdio.h> #include "sciteco.h" #include "parser.h" @@ -37,12 +38,14 @@ is_glob_pattern(const gchar *str) } class Globber { + GFileTest test; gchar *dirname; GDir *dir; GPatternSpec *pattern; public: - Globber(const gchar *pattern); + Globber(const gchar *pattern, + GFileTest test = G_FILE_TEST_EXISTS); ~Globber(); gchar *next(void); @@ -52,13 +55,22 @@ public: * Command states */ -class StateGlob : public StateExpectFile { +class StateGlob_pattern : public StateExpectFile { +public: + StateGlob_pattern() : StateExpectFile(true, false) {} + +private: + State *done(const gchar *str); +}; + +class StateGlob_filename : public StateExpectFile { private: State *done(const gchar *str); }; namespace States { - extern StateGlob glob; + extern StateGlob_pattern glob_pattern; + extern StateGlob_filename glob_filename; } } /* namespace SciTECO */ diff --git a/src/parser.cpp b/src/parser.cpp index b16b792..5e8f6f6 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1802,7 +1802,7 @@ StateECommand::StateECommand() : State() transitions['G'] = &States::egcommand; transitions['I'] = &States::insert_nobuilding; transitions['M'] = &States::macro_file; - transitions['N'] = &States::glob; + transitions['N'] = &States::glob_pattern; transitions['S'] = &States::scintilla_symbols; transitions['Q'] = &States::eqcommand; transitions['U'] = &States::eucommand; |