From ea2466fe69bd082d379e95e1567f3de0b76de243 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 8 Apr 2017 12:28:54 +0200 Subject: 2017-04-08 12:15:00 --- context/data/npp/context/notepad++.ini | 57 + context/data/npp/notepad++.ini | 56 - .../context/lexers/scite-context-lexer-bibtex.lua | 24 +- .../context/lexers/scite-context-lexer-cld.lua | 10 +- .../context/lexers/scite-context-lexer-cpp-web.lua | 10 +- .../context/lexers/scite-context-lexer-cpp.lua | 2 +- .../context/lexers/scite-context-lexer-dummy.lua | 2 +- .../lexers/scite-context-lexer-lua-longstring.lua | 2 +- .../context/lexers/scite-context-lexer-lua.lua | 4 +- .../context/lexers/scite-context-lexer-mps.lua | 2 +- .../lexers/scite-context-lexer-pdf-object.lua | 2 +- .../lexers/scite-context-lexer-pdf-xref.lua | 2 +- .../context/lexers/scite-context-lexer-pdf.lua | 4 +- .../context/lexers/scite-context-lexer-sql.lua | 2 +- .../context/lexers/scite-context-lexer-tex-web.lua | 10 +- .../context/lexers/scite-context-lexer-tex.lua | 2 +- .../context/lexers/scite-context-lexer-txt.lua | 2 +- .../lexers/scite-context-lexer-web-snippets.lua | 2 +- .../context/lexers/scite-context-lexer-web.lua | 2 +- .../lexers/scite-context-lexer-xml-cdata.lua | 2 +- .../lexers/scite-context-lexer-xml-comment.lua | 2 +- .../lexers/scite-context-lexer-xml-script.lua | 2 +- .../context/lexers/scite-context-lexer-xml.lua | 2 +- .../scite/context/lexers/scite-context-lexer.lua | 457 +- .../context/lexers/themes/scite-context-theme.lua | 239 +- .../context/scite-context-external.properties | 2 +- context/data/scite/context/scite-ctx.lua | 47 +- .../context/data/scite-context-data-context.lua | 4 + .../context/data/scite-context-data-interfaces.lua | 10 + .../context/data/scite-context-data-metafun.lua | 4 + .../context/data/scite-context-data-metapost.lua | 9 + .../context/data/scite-context-data-tex.lua | 9 + context/data/textadept/context/init.lua | 69 + context/data/textadept/context/lexers/lexer.rme | 1 + .../context/lexers/scite-context-lexer-bibtex.lua | 196 + .../context/lexers/scite-context-lexer-cld.lua | 24 + .../context/lexers/scite-context-lexer-cpp-web.lua | 24 + .../context/lexers/scite-context-lexer-cpp.lua | 189 + .../context/lexers/scite-context-lexer-dummy.lua | 36 + .../lexers/scite-context-lexer-lua-longstring.lua | 32 + .../context/lexers/scite-context-lexer-lua.lua | 389 + .../context/lexers/scite-context-lexer-mps.lua | 183 + .../lexers/scite-context-lexer-pdf-object.lua | 137 + .../lexers/scite-context-lexer-pdf-xref.lua | 44 + .../context/lexers/scite-context-lexer-pdf.lua | 205 + .../context/lexers/scite-context-lexer-sql.lua | 239 + .../context/lexers/scite-context-lexer-tex-web.lua | 24 + .../context/lexers/scite-context-lexer-tex.lua | 567 + .../context/lexers/scite-context-lexer-txt.lua | 81 + .../lexers/scite-context-lexer-web-snippets.lua | 134 + .../context/lexers/scite-context-lexer-web.lua | 68 + .../lexers/scite-context-lexer-xml-cdata.lua | 34 + .../lexers/scite-context-lexer-xml-comment.lua | 34 + .../lexers/scite-context-lexer-xml-script.lua | 34 + .../context/lexers/scite-context-lexer-xml.lua | 351 + .../context/lexers/scite-context-lexer.lua | 2293 + .../context/modules/textadept-context-files.lua | 119 + .../context/modules/textadept-context-runner.lua | 254 + .../context/modules/textadept-context-settings.lua | 131 + .../context/modules/textadept-context-types.lua | 135 + .../data/textadept/context/textadept-context.cmd | 2 + .../data/textadept/context/textadept-context.sh | 12 + .../context/themes/scite-context-theme.lua | 159 + doc/context/documents/general/qrcs/setup-cs.pdf | Bin 799756 -> 808147 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 801550 -> 809574 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 804302 -> 811962 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 799412 -> 805750 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 799681 -> 809780 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 797372 -> 806218 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 796607 -> 804690 bytes scripts/context/lua/mtx-context.lua | 6 + scripts/context/lua/mtx-fonts.lua | 2 +- scripts/context/lua/mtx-interface.lua | 26 + scripts/context/lua/mtxrun.lua | 258 +- scripts/context/stubs/mswin/mtxrun.lua | 258 +- scripts/context/stubs/unix/mtxrun | 258 +- scripts/context/stubs/win64/mtxrun.lua | 258 +- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-cff.lua | 53 +- tex/context/base/mkiv/font-dsp.lua | 2 +- tex/context/base/mkiv/font-onr.lua | 10 +- tex/context/base/mkiv/font-otr.lua | 4 +- tex/context/base/mkiv/lxml-tab.lua | 40 +- tex/context/base/mkiv/status-files.pdf | Bin 25624 -> 25625 bytes tex/context/base/mkiv/status-lua.pdf | Bin 422692 -> 422657 bytes tex/context/base/mkiv/strc-flt.mkvi | 6 +- tex/context/base/mkiv/util-fil.lua | 29 +- tex/context/base/mkiv/util-lib-imp-gm.lua | 4 +- tex/context/base/mkiv/util-lib-imp-gs.lua | 4 +- tex/context/base/mkiv/util-lib.lua | 9 +- tex/context/base/mkiv/util-sac.lua | 212 +- tex/context/base/mkiv/util-str.lua | 4 - tex/context/interface/mkii/cont-en.xml | 10396 ----- tex/context/interface/mkiv/context-en.xml | 45468 +++++++++++++++++++ tex/context/interface/mkiv/i-common-argument.xml | 26 + tex/context/interface/mkiv/i-common-instance.xml | 127 + tex/context/interface/mkiv/i-context.pdf | Bin 804302 -> 811962 bytes tex/context/interface/mkiv/i-dataset.xml | 2 +- tex/context/interface/mkiv/i-pagestate.xml | 2 +- tex/context/interface/mkiv/i-readme.pdf | Bin 60771 -> 60771 bytes tex/context/interface/mkiv/i-verbatim.xml | 4 +- tex/context/modules/mkiv/x-setups-basics.mkiv | 98 +- tex/context/modules/mkiv/x-setups-overview.mkiv | 2 + tex/generic/context/luatex/luatex-fonts-merged.lua | 54 +- 107 files changed, 53754 insertions(+), 11062 deletions(-) create mode 100644 context/data/npp/context/notepad++.ini delete mode 100644 context/data/npp/notepad++.ini create mode 100644 context/data/textadept/context/data/scite-context-data-context.lua create mode 100644 context/data/textadept/context/data/scite-context-data-interfaces.lua create mode 100644 context/data/textadept/context/data/scite-context-data-metafun.lua create mode 100644 context/data/textadept/context/data/scite-context-data-metapost.lua create mode 100644 context/data/textadept/context/data/scite-context-data-tex.lua create mode 100644 context/data/textadept/context/init.lua create mode 100644 context/data/textadept/context/lexers/lexer.rme create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-bibtex.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-cld.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-cpp-web.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-cpp.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-dummy.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-lua-longstring.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-lua.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-mps.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-pdf-object.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-pdf-xref.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-pdf.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-sql.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-tex-web.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-tex.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-txt.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-web-snippets.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-web.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-xml-cdata.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-xml-comment.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-xml-script.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer-xml.lua create mode 100644 context/data/textadept/context/lexers/scite-context-lexer.lua create mode 100644 context/data/textadept/context/modules/textadept-context-files.lua create mode 100644 context/data/textadept/context/modules/textadept-context-runner.lua create mode 100644 context/data/textadept/context/modules/textadept-context-settings.lua create mode 100644 context/data/textadept/context/modules/textadept-context-types.lua create mode 100644 context/data/textadept/context/textadept-context.cmd create mode 100644 context/data/textadept/context/textadept-context.sh create mode 100644 context/data/textadept/context/themes/scite-context-theme.lua delete mode 100644 tex/context/interface/mkii/cont-en.xml create mode 100644 tex/context/interface/mkiv/context-en.xml diff --git a/context/data/npp/context/notepad++.ini b/context/data/npp/context/notepad++.ini new file mode 100644 index 000000000..50b02e294 --- /dev/null +++ b/context/data/npp/context/notepad++.ini @@ -0,0 +1,57 @@ +# You can use the lexers that come with context and athat are meant for scite also for notepad++. On +# my machine I always install such a portable program in c:\data\system\notepadplusplus (avoiding +# funny characters). +# +# (1) Download a version of scintillua++ that matches the current version if notepad++ and unzip +# the archive in a temporary place. +# +# c:\data\notepadplusplus\* +# +# (2) Copy these two dlls:: +# +# c:\data\notepadplusplus\plugins\Scintillua++.dll +# c:\data\notepadplusplus\plugins\Config\Scintillua++\LexLPeg.dll +# +# (3) Copy this file to: +# +# c:\data\notepadplusplus\plugins\Config\Scintillua++.ini +# +# (4) Copy the files from the texmf/context/data/scite/context so that you get: +# +# c:\data\notepadplusplus\plugins\Config\data\scite-context-data-*.lua +# c:\data\notepadplusplus\plugins\Config\themes\scite-context-theme.lua +# c:\data\notepadplusplus\plugins\Config\themes\lexer.lua +# c:\data\notepadplusplus\plugins\Config\themes\scite-context-lexer.lua +# c:\data\notepadplusplus\plugins\Config\themes\scite-context-lexer-*.lua +# +# Now you should get the standard context lexing for the file types mentioned below. I might add a few +# more (consistent) lexers. Beware: we don't use the lexer.lua file that ships with scintillua++. Among +# the reasons is that when I first played with this variant of lexing the scintillua implementation was +# quite slow, so I redid the code with some agressive optimization (in context a good test file is the +# character database file. There is still room for improvement. One problem with the lua lexer is that +# there is not much communication possible so that getting the state involves guesswork. +# +# Also, we already had lpeg based lexing in context so it made more sense to find some common ground so +# that I could share code (a bit of a hybrid approach). There are some extra features like showing +# invisible spaces and most noticeably spell checking (for more info see the manual). +# +# The lexer assumes that you have the dejavu mono fonts installed. These cover a wide repertoire of +# characters. Some features offered for scite won't be available because no additional menu items etc +# are defined. +# +# In due time some more configuration files will be added for notepad++. Maybe some more can be set up +# below. + +theme=scite-context-theme +override=true + +scite-context-lexer-tex=*.tex;*.mkii;*.mkiv;*.mkvi;*.mkix;*.mkxi +scite-context-lexer-xml=*.xml;*.xsl;*.xsd;*.fo;*.exa;*.rlb;*.rlg;*.rlv;*.rng;*.xfdf;*.xslt;*.dtd;*.lmx;*.htm;*.html;*.xhtml;*.ctx;*.export;*.svg;*.xul +scite-context-lexer-mps=*.mp;*.mpx +scite-context-lexer-lua=*.lua;*.luc;*.cld;*.tuc;*.luj;*.lum;*.tma;*.lfg;*.luv;*.lui +scite-context-lexer-txt=*.txt +scite-context-lexer-pdf=*.pdf +scite-context-lexer-web=*.w;*.ww +scite-context-lexer-cpp=*.h;*.c;*.hh;*.cc;*.hpp;*.cpp;*.hxx;*.cxx +scite-context-lexer-bibtex=*.bib +scite-context-lexer-sql=*.sql diff --git a/context/data/npp/notepad++.ini b/context/data/npp/notepad++.ini deleted file mode 100644 index 48c5cac3b..000000000 --- a/context/data/npp/notepad++.ini +++ /dev/null @@ -1,56 +0,0 @@ -# You can use the lexers that come with context and athat are meant for scite also for notepad++. On -# my machine I always install such a portable program in c:\data\system\notepadplusplus (avoiding -# funny characters). -# -# (1) Download a version of scintillua++ that matches the current version if notepad++ and unzip -# the archive in a temporary place. -# -# c:\data\notepadplusplus\* -# -# (2) Copy the following files (we assume that a 64 bit version is used): -# -# c:\data\notepadplusplus\plugins\Config\Scintillua++\LexLPeg_64.dll -# -# (3) Copy this file to: -# -# c:\data\notepadplusplus\plugins\Config\Scintillua++.ini -# -# (4) Copy the files from the texmf/context/data/scite/context so that you get: -# -# c:\data\notepadplusplus\plugins\Config\data\scite-context-data-*.lua -# c:\data\notepadplusplus\plugins\Config\themes\scite-context-theme.lua -# c:\data\notepadplusplus\plugins\Config\themes\lexer.lua -# c:\data\notepadplusplus\plugins\Config\themes\scite-context-lexer.lua -# c:\data\notepadplusplus\plugins\Config\themes\scite-context-lexer-*.lua -# -# Now you should get the standard context lexing for the file types mentioned below. I might add a few -# more (consistent) lexers. Beware: we don't use the lexer.lua file that ships with scintillua++. Among -# the reasons is that when I first played with this variant of lexing the scintillua implementation was -# quite slow, so I redid the code with some agressive optimization (in context a good test file is the -# character database file. There is still room for improvement. One problem with the lua lexer is that -# there is not much communication possible so that getting the state involves guesswork. -# -# Also, we already had lpeg based lexing in context so it made more sense to find some common ground so -# that I could share code (a bit of a hybrid approach). There are some extra features like showing -# invisible spaces and most noticeably spell checking (for more info see the manual). -# -# The lexer assumes that you have the dejavu mono fonts installed. These cover a wide repertoire of -# characters. Some features offered for scite won't be available because no additional menu items etc -# are defined. -# -# In due time some more configuration files will be added for notepad++. Maybe some more can be set up -# below. - -theme=scite-context-theme -override=true - -scite-context-lexer-tex=*.tex;*.mkii;*.mkiv;*.mkvi;*.mkix;*.mkxi -scite-context-lexer-xml=*.xml;*.xsl;*.xsd;*.fo;*.exa;*.rlb;*.rlg;*.rlv;*.rng;*.xfdf;*.xslt;*.dtd;*.lmx;*.htm;*.html;*.xhtml;*.ctx;*.export;*.svg;*.xul -scite-context-lexer-mps=*.mp;*.mpx -scite-context-lexer-lua=*.lua;*.luc;*.cld;*.tuc;*.luj;*.lum;*.tma;*.lfg;*.luv;*.lui -scite-context-lexer-txt=*.txt -scite-context-lexer-pdf=*.pdf -scite-context-lexer-web=*.w;*.ww -scite-context-lexer-cpp=*.h;*.c;*.hh;*.cc;*.hpp;*.cpp;*.hxx;*.cxx -scite-context-lexer-bibtex=*.bib -scite-context-lexer-sql=*.sql diff --git a/context/data/scite/context/lexers/scite-context-lexer-bibtex.lua b/context/data/scite/context/lexers/scite-context-lexer-bibtex.lua index ebcd7cbc6..b53da82ea 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-bibtex.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-bibtex.lua @@ -10,22 +10,22 @@ local global, string, table, lpeg = _G, string, table, lpeg local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V local type = type -local lexer = require("lexer") -local context = lexer.context -local patterns = context.patterns +local lexer = require("scite-context-lexer") +local context = lexer.context +local patterns = context.patterns -local token = lexer.token -local exact_match = lexer.exact_match +local token = lexer.token +local exact_match = lexer.exact_match -local bibtexlexer = lexer.new("bib","scite-context-lexer-bibtex") -local whitespace = bibtexlexer.whitespace +local bibtexlexer = lexer.new("bib","scite-context-lexer-bibtex") +local whitespace = bibtexlexer.whitespace - local escape, left, right = P("\\"), P('{'), P('}') +local escape, left, right = P("\\"), P('{'), P('}') - patterns.balanced = P { - [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, - [2] = left * V(1) * right - } +patterns.balanced = P { + [1] = ((escape * (left+right)) + (1 - (left+right)) + V(2))^0, + [2] = left * V(1) * right +} -- taken from bibl-bib.lua diff --git a/context/data/scite/context/lexers/scite-context-lexer-cld.lua b/context/data/scite/context/lexers/scite-context-lexer-cld.lua index 3442a195c..7bda7800e 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-cld.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-cld.lua @@ -6,12 +6,12 @@ local info = { license = "see context related readme files", } -local lexer = require("lexer") -local context = lexer.context -local patterns = context.patterns +local lexer = require("scite-context-lexer") +local context = lexer.context +local patterns = context.patterns -local cldlexer = lexer.new("cld","scite-context-lexer-cld") -local lualexer = lexer.load("scite-context-lexer-lua") +local cldlexer = lexer.new("cld","scite-context-lexer-cld") +local lualexer = lexer.load("scite-context-lexer-lua") -- can probably be done nicer now, a bit of a hack diff --git a/context/data/scite/context/lexers/scite-context-lexer-cpp-web.lua b/context/data/scite/context/lexers/scite-context-lexer-cpp-web.lua index daa9221ba..631a802fe 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-cpp-web.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-cpp-web.lua @@ -6,12 +6,12 @@ local info = { license = "see context related readme files", } -local lexer = require("lexer") -local context = lexer.context -local patterns = context.patterns +local lexer = require("scite-context-lexer") +local context = lexer.context +local patterns = context.patterns -local cppweblexer = lexer.new("cpp-web","scite-context-lexer-cpp") -local cpplexer = lexer.load("scite-context-lexer-cpp") +local cppweblexer = lexer.new("cpp-web","scite-context-lexer-cpp") +local cpplexer = lexer.load("scite-context-lexer-cpp") -- can probably be done nicer now, a bit of a hack diff --git a/context/data/scite/context/lexers/scite-context-lexer-cpp.lua b/context/data/scite/context/lexers/scite-context-lexer-cpp.lua index 91ada7828..d9079855f 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-cpp.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-cpp.lua @@ -10,7 +10,7 @@ local info = { local P, R, S = lpeg.P, lpeg.R, lpeg.S -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-dummy.lua b/context/data/scite/context/lexers/scite-context-lexer-dummy.lua index 9465561f3..5d3096b7d 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-dummy.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-dummy.lua @@ -10,7 +10,7 @@ local info = { -- we need to trigger that, for instance in the bibtex lexer, but still -- we get failed lexing -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-lua-longstring.lua b/context/data/scite/context/lexers/scite-context-lexer-lua-longstring.lua index 855adbe4e..b1304f65c 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-lua-longstring.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-lua-longstring.lua @@ -6,7 +6,7 @@ local info = { license = "see context related readme files", } -local lexer = require("lexer") -- require("scite-context-lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-lua.lua b/context/data/scite/context/lexers/scite-context-lexer-lua.lua index 973fe3c2a..d35ad5b15 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-lua.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-lua.lua @@ -13,7 +13,7 @@ local P, R, S, C, Cmt, Cp = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cmt, lpeg.Cp local match, find = string.match, string.find local setmetatable = setmetatable -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns @@ -25,7 +25,7 @@ local lualexer = lexer.new("lua","scite-context-lexer-lua") local whitespace = lualexer.whitespace local stringlexer = lexer.load("scite-context-lexer-lua-longstring") -local labellexer = lexer.load("scite-context-lexer-lua-labelstring") +----- labellexer = lexer.load("scite-context-lexer-lua-labelstring") local directives = { } -- communication channel diff --git a/context/data/scite/context/lexers/scite-context-lexer-mps.lua b/context/data/scite/context/lexers/scite-context-lexer-mps.lua index b4be44fe5..1c87ea6d0 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-mps.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-mps.lua @@ -10,7 +10,7 @@ local global, string, table, lpeg = _G, string, table, lpeg local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V local type = type -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-pdf-object.lua b/context/data/scite/context/lexers/scite-context-lexer-pdf-object.lua index 1fb95838a..155a9bd51 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-pdf-object.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-pdf-object.lua @@ -10,7 +10,7 @@ local info = { local P, R, S, C, V = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.V -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-pdf-xref.lua b/context/data/scite/context/lexers/scite-context-lexer-pdf-xref.lua index 7097c41a6..14ba5296b 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-pdf-xref.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-pdf-xref.lua @@ -10,7 +10,7 @@ local info = { local P, R = lpeg.P, lpeg.R -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-pdf.lua b/context/data/scite/context/lexers/scite-context-lexer-pdf.lua index f8e4e7380..0fd238d63 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-pdf.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-pdf.lua @@ -6,12 +6,12 @@ local info = { license = "see context related readme files", } --- pdf is normally startic .. i.e. not edited so we don't really +-- pdf is normally static .. i.e. not edited so we don't really -- need embedded lexers. local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-sql.lua b/context/data/scite/context/lexers/scite-context-lexer-sql.lua index 62f0fa820..cf0a03331 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-sql.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-sql.lua @@ -8,7 +8,7 @@ local info = { local P, R, S = lpeg.P, lpeg.R, lpeg.S -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-tex-web.lua b/context/data/scite/context/lexers/scite-context-lexer-tex-web.lua index 5d8859c26..88499a9c2 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-tex-web.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-tex-web.lua @@ -6,12 +6,12 @@ local info = { license = "see context related readme files", } -local lexer = require("lexer") -local context = lexer.context -local patterns = context.patterns +local lexer = require("scite-context-lexer") +local context = lexer.context +local patterns = context.patterns -local texweblexer = lexer.new("tex-web","scite-context-lexer-tex") -local texlexer = lexer.load("scite-context-lexer-tex") +local texweblexer = lexer.new("tex-web","scite-context-lexer-tex") +local texlexer = lexer.load("scite-context-lexer-tex") -- can probably be done nicer now, a bit of a hack diff --git a/context/data/scite/context/lexers/scite-context-lexer-tex.lua b/context/data/scite/context/lexers/scite-context-lexer-tex.lua index 027c8767e..3f3673347 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-tex.lua @@ -31,7 +31,7 @@ local P, R, S, V, C, Cmt, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, l local type, next = type, next local find, match, lower, upper = string.find, string.match, string.lower, string.upper -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns local inform = context.inform diff --git a/context/data/scite/context/lexers/scite-context-lexer-txt.lua b/context/data/scite/context/lexers/scite-context-lexer-txt.lua index 43eec2c35..8ecfff7cb 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-txt.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-txt.lua @@ -9,7 +9,7 @@ local info = { local P, S, Cmt, Cp = lpeg.P, lpeg.S, lpeg.Cmt, lpeg.Cp local find, match = string.find, string.match -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-web-snippets.lua b/context/data/scite/context/lexers/scite-context-lexer-web-snippets.lua index 196a545bc..3cef71739 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-web-snippets.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-web-snippets.lua @@ -8,7 +8,7 @@ local info = { local P, R, S, C, Cg, Cb, Cs, Cmt, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cg, lpeg.Cb, lpeg.Cs, lpeg.Cmt, lpeg.match -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-web.lua b/context/data/scite/context/lexers/scite-context-lexer-web.lua index 86ae76644..81a6f90df 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-web.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-web.lua @@ -8,7 +8,7 @@ local info = { local P, R, S = lpeg.P, lpeg.R, lpeg.S -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-xml-cdata.lua b/context/data/scite/context/lexers/scite-context-lexer-xml-cdata.lua index e6276da0d..f5ca86cb2 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-xml-cdata.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-xml-cdata.lua @@ -8,7 +8,7 @@ local info = { local P = lpeg.P -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-xml-comment.lua b/context/data/scite/context/lexers/scite-context-lexer-xml-comment.lua index b5b3fefe0..40de8f603 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-xml-comment.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-xml-comment.lua @@ -8,7 +8,7 @@ local info = { local P = lpeg.P -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-xml-script.lua b/context/data/scite/context/lexers/scite-context-lexer-xml-script.lua index bbb938dc5..a1b717a6a 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-xml-script.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-xml-script.lua @@ -8,7 +8,7 @@ local info = { local P = lpeg.P -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer-xml.lua b/context/data/scite/context/lexers/scite-context-lexer-xml.lua index 77c89b1d6..bbdb3febc 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-xml.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-xml.lua @@ -17,7 +17,7 @@ local P, R, S, C, Cmt, Cp = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cmt, lpeg.Cp local type = type local match, find = string.match, string.find -local lexer = require("lexer") +local lexer = require("scite-context-lexer") local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/context/lexers/scite-context-lexer.lua b/context/data/scite/context/lexers/scite-context-lexer.lua index 152a05777..eedc7f906 100644 --- a/context/data/scite/context/lexers/scite-context-lexer.lua +++ b/context/data/scite/context/lexers/scite-context-lexer.lua @@ -8,11 +8,6 @@ local info = { } --- todo: hook into context resolver etc --- todo: only old api in lexers, rest in context subnamespace --- todo: make sure we can run in one state .. copies or shared? --- todo: auto-nesting - if lpeg.setmaxstack then lpeg.setmaxstack(1000) end local log = false @@ -27,74 +22,118 @@ local inspect = false -- can save some 15% (maybe easier on scintilla) -- GET GOING -- --- You need to copy this file over lexer.lua. In principle other lexers could --- work too but not now. Maybe some day. All patterns will move into the patterns --- name space. I might do the same with styles. If you run an older version of --- SciTE you can take one of the archives. Pre 3.41 versions can just be copied --- to the right path, as there we still use part of the normal lexer. +-- You need to copy this file over lexer.lua. In principle other lexers could work +-- too but not now. Maybe some day. All patterns will move into the patterns name +-- space. I might do the same with styles. If you run an older version of SciTE you +-- can take one of the archives. Pre 3.41 versions can just be copied to the right +-- path, as there we still use part of the normal lexer. Below we mention some +-- issues with different versions of SciTE. We try to keep up with changes but best +-- check careful if the version that yuou install works as expected because SciTE +-- and the scintillua dll need to be in sync. -- -- REMARK -- --- We started using lpeg lexing as soon as it came available. Because we had --- rather demanding files an dalso wanted to use nested lexers, we ended up with --- our own variant (more robust and faster). As a consequence successive versions --- had to be adapted to changes in the (still unstable) api. In addition to --- lexing we also have spell checking and such. +-- We started using lpeg lexing as soon as it came available. Because we had rather +-- demanding files and also wanted to use nested lexers, we ended up with our own +-- variant. At least at that time this was more robust and also much faster (as we +-- have some pretty large Lua data files and also work with large xml files). As a +-- consequence successive versions had to be adapted to changes in the (at that time +-- still unstable) api. In addition to lexing we also have spell checking and such. +-- Around version 3.60 things became more stable so I don't expect to change much. +-- +-- LEXING +-- +-- When pc's showed up we wrote our own editor (texedit) in MODULA 2. It was fast, +-- had multiple overlapping (text) windows, could run in the at most 1M memory at +-- that time, etc. The realtime file browsing with lexing that we had at that time +-- is still on my current wish list. The color scheme and logic that we used related +-- to the logic behind the ConTeXt user interface that evolved. +-- +-- Later I rewrote the editor in perl/tk. I don't like the perl syntax but tk +-- widgets are very powerful and hard to beat. In fact, TextAdept reminds me of +-- that: wrap your own interface around a framework (tk had an edit control that one +-- could control completely not that different from scintilla). Last time I checked +-- it still ran fine so I might try to implement something like its file handling in +-- TextAdept. -- --- STATUS +-- In the end I settled for SciTE for which I wrote TeX and MetaPost lexers that +-- could handle keyword sets. With respect to lexing (syntax highlighting) ConTeXt +-- has a long history, if only because we need it for manuals. Anyway, in the end we +-- arrived at lpeg based lexing (which is quite natural as we have lots of lpeg +-- usage in ConTeXt). The basic color schemes haven't changed much. The most +-- prominent differences are the nested lexers. -- --- todo: maybe use a special stripped version of the dll (stable api) --- todo: play with hotspot and other properties --- wish: access to all scite properties and in fact integrate in scite --- todo: add proper tracing and so .. not too hard as we can run on mtxrun --- todo: get rid of these lexers.STYLE_XX and lexers.XX (hide such details) +-- In the meantime I made the lexer suitable for typesetting sources which was no +-- big deal as we already had that in place (ConTeXt used lpeg from the day it +-- showed up so we have several lexing options there too). +-- +-- Keep in mind that in ConTeXt (typesetting) lexing can follow several approached: +-- line based (which is handy for verbatim mode), syntax mode (which is nice for +-- tutorials), and tolerant mode (so that one can also show bad examples or errors). +-- These demands can clash. -- -- HISTORY -- +-- The remarks below are more for myself so that I keep track of changes in the +-- way we adapt to the changes in the scintillua and scite. +-- -- The fold and lex functions are copied and patched from original code by Mitchell --- (see lexer.lua). All errors are mine. The ability to use lpeg is a real nice --- adition and a brilliant move. The code is a byproduct of the (mainly Lua based) --- textadept (still a rapidly moving target) that unfortunately misses a realtime --- output pane. On the other hand, SciTE is somewhat crippled by the fact that we --- cannot pop in our own (language dependent) lexer into the output pane (somehow --- the errorlist lexer is hard coded into the editor). Hopefully that will change --- some day. +-- (see lexer.lua) in the scintillua distribution. So whatever I say below, assume +-- that all errors are mine. The ability to use lpeg in scintilla is a real nice +-- addition and a brilliant move. The code is a byproduct of the (mainly Lua based) +-- TextAdept which at the time I ran into it was a rapidly moving target so I +-- decided to stick ot SciTE. When I played with it, it had no realtime output pane +-- although that seems to be dealt with now (2017). I need to have a look at it in +-- more detail but a first test again made the output hang and it was a bit slow too +-- (and I also want the log pane as SciTE has it, on the right, in view). So, for +-- now I stick to SciTE even when it's somewhat crippled by the fact that we cannot +-- hook our own (language dependent) lexer into the output pane (somehow the +-- errorlist lexer is hard coded into the editor). Hopefully that will change some +-- day. The ConTeXt distribution has cmd runner for textdept that will plug in the +-- lexers discussed here as well as a dedicated runner. Considere it an experiment. -- --- Starting with SciTE version 3.20 there is an issue with coloring. As we still --- lack a connection with SciTE itself (properties as well as printing to the log --- pane) and we cannot trace this (on windows). As far as I can see, there are no --- fundamental changes in lexer.lua or LexLPeg.cxx so it must be in Scintilla --- itself. So for the moment I stick to 3.10. Indicators are: no lexing of 'next' --- and 'goto