local info = { version = 1.400, comment = "basics for scintilla lpeg lexer for context/metafun", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files", comment = "contains copyrighted code from mitchell.att.foicica.com", } -- 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 local trace = false local detail = false local show = false -- nice for tracing (also for later) local collapse = false -- can save some 15% (maybe easier on scintilla) local inspect = false -- can save some 15% (maybe easier on scintilla) -- local log = true -- local trace = true -- 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. -- -- 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. -- -- STATUS -- -- 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) -- -- HISTORY -- -- 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. -- -- 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