diff options
Diffstat (limited to 'context/data')
15 files changed, 103 insertions, 66 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-cld.lua b/context/data/scite/lexers/scite-context-lexer-cld.lua index 9623e2efe..4d235b1af 100644 --- a/context/data/scite/lexers/scite-context-lexer-cld.lua +++ b/context/data/scite/lexers/scite-context-lexer-cld.lua @@ -9,8 +9,10 @@ local info = { local lexer = lexer local token = lexer.token -local cldlexer = { _NAME = "cld" } -local lualexer = lexer.load('scite-context-lexer-lua') +-- local cldlexer = { _NAME = "cld" } +local cldlexer = { _NAME = "lua" } -- get whitespace right +local whitespace = lexer.WHITESPACE +local lualexer = lexer.load('scite-context-lexer-lua') cldlexer._rules = lualexer._rules_cld cldlexer._tokenstyles = lualexer._tokenstyles @@ -18,3 +20,4 @@ cldlexer._foldsymbols = lualexer._foldsymbols cldlexer._directives = lualexer._directives return cldlexer + diff --git a/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua b/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua index 6cc79aeb9..f4ac2cff0 100644 --- a/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua +++ b/context/data/scite/lexers/scite-context-lexer-lua-longstring.lua @@ -2,8 +2,7 @@ local lexer = lexer local token = lexer.token local P = lpeg.P -local stringlexer = { _NAME = "string" } - +local stringlexer = { _NAME = "lua-longstring" } local whitespace = lexer.WHITESPACE local space = lexer.space diff --git a/context/data/scite/lexers/scite-context-lexer-lua.lua b/context/data/scite/lexers/scite-context-lexer-lua.lua index 248672b06..473e45bb2 100644 --- a/context/data/scite/lexers/scite-context-lexer-lua.lua +++ b/context/data/scite/lexers/scite-context-lexer-lua.lua @@ -17,10 +17,10 @@ local setmetatable = setmetatable -- beware: all multiline is messy, so even if it's no lexer, it should be an embedded lexer local lualexer = { _NAME = "lua" } -local stringlexer = lexer.load("scite-context-lexer-lua-longstring") - local whitespace = lexer.WHITESPACE +local stringlexer = lexer.load("scite-context-lexer-lua-longstring") + local directives = { } -- communication channel -- this will be extended diff --git a/context/data/scite/lexers/scite-context-lexer-mps.lua b/context/data/scite/lexers/scite-context-lexer-mps.lua index 4dd498b53..5e8a440fa 100644 --- a/context/data/scite/lexers/scite-context-lexer-mps.lua +++ b/context/data/scite/lexers/scite-context-lexer-mps.lua @@ -14,10 +14,8 @@ local token, exact_match = lexer.token, lexer.exact_match local P, R, S, V, C, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cmt local type = type -local metafunlexer = { _NAME = "metafun" } - +local metafunlexer = { _NAME = "mps" } local whitespace = lexer.WHITESPACE - local context = lexer.context local metapostprimitives = { } diff --git a/context/data/scite/lexers/scite-context-lexer-pdf-object.lua b/context/data/scite/lexers/scite-context-lexer-pdf-object.lua index ec950c26c..e98be07a7 100644 --- a/context/data/scite/lexers/scite-context-lexer-pdf-object.lua +++ b/context/data/scite/lexers/scite-context-lexer-pdf-object.lua @@ -10,10 +10,8 @@ local lexer = lexer local token = lexer.token local P, R, S, C, V = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.V -local pdfobjectlexer = { _NAME = "pdfobject" } - +local pdfobjectlexer = { _NAME = "pdf-object" } local whitespace = lexer.WHITESPACE -- triggers states - local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua b/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua index 9fd6df992..e250d3b84 100644 --- a/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua +++ b/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua @@ -10,13 +10,12 @@ local lexer = lexer local token = lexer.token local P = lpeg.P -local pdfxreflexer = { _NAME = "pdfxref" } -local pdfobjectlexer = lexer.load("scite-context-lexer-pdf-object") - +local pdfxreflexer = { _NAME = "pdf-xref" } +local whitespace = lexer.WHITESPACE -- triggers states local context = lexer.context local patterns = context.patterns -local whitespace = lexer.WHITESPACE -- triggers states +local pdfobjectlexer = lexer.load("scite-context-lexer-pdf-object") local spacing = patterns.spacing diff --git a/context/data/scite/lexers/scite-context-lexer-pdf.lua b/context/data/scite/lexers/scite-context-lexer-pdf.lua index 61cf819f0..6ed7d1ecd 100644 --- a/context/data/scite/lexers/scite-context-lexer-pdf.lua +++ b/context/data/scite/lexers/scite-context-lexer-pdf.lua @@ -13,11 +13,11 @@ local token = lexer.token local P, R, S = lpeg.P, lpeg.R, lpeg.S local pdflexer = { _NAME = "pdf" } +local whitespace = lexer.WHITESPACE -- triggers states + local pdfobjectlexer = lexer.load("scite-context-lexer-pdf-object") local pdfxreflexer = lexer.load("scite-context-lexer-pdf-xref") -local whitespace = lexer.WHITESPACE -- triggers states - local context = lexer.context local patterns = context.patterns diff --git a/context/data/scite/lexers/scite-context-lexer-tex.lua b/context/data/scite/lexers/scite-context-lexer-tex.lua index 3408d1eb4..e5fbf5900 100644 --- a/context/data/scite/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/lexers/scite-context-lexer-tex.lua @@ -44,12 +44,12 @@ local find, match, lower = string.find, string.match, string.lower -- module(...) -local contextlexer = { _NAME = "context" } +local contextlexer = { _NAME = "tex" } +local whitespace = lexer.WHITESPACE + local cldlexer = lexer.load('scite-context-lexer-cld') local mpslexer = lexer.load('scite-context-lexer-mps') --- local cldlexer = lexer.load('scite-context-lexer-lua') -- test - local commands = { en = { } } local primitives = { } local helpers = { } @@ -189,8 +189,6 @@ end) local commentline = P('%') * (1-S("\n\r"))^0 local endline = S("\n\r")^1 -local whitespace = lexer.WHITESPACE - local space = lexer.space -- S(" \n\r\t\f\v") local any = lexer.any local backslash = P("\\") @@ -405,7 +403,7 @@ local stoplua = P("\\stop") * Cmt(luaenvironment,stopdisplaylua) + Cmt(P("}"),stopinlinelua_e) local startluacode = token("embedded", startlua) -local stopluacode = token("embedded", stoplua) +local stopluacode = #stoplua * token("embedded", stoplua) local metafuncall = ( P("use") + P("reusable") + P("unique") ) * ("MPgraphic") diff --git a/context/data/scite/lexers/scite-context-lexer-txt.lua b/context/data/scite/lexers/scite-context-lexer-txt.lua index 2f476a6a8..f607ee1eb 100644 --- a/context/data/scite/lexers/scite-context-lexer-txt.lua +++ b/context/data/scite/lexers/scite-context-lexer-txt.lua @@ -13,11 +13,9 @@ local token = lexer.token local P, S, Cmt = lpeg.P, lpeg.S, lpeg.Cmt local find, match = string.find, string.match -local textlexer = { _NAME = "text" } - -local context = lexer.context - +local textlexer = { _NAME = "txt" } local whitespace = lexer.WHITESPACE +local context = lexer.context local space = lexer.space local any = lexer.any diff --git a/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua b/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua index 511465b01..7dfaed5bc 100644 --- a/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua +++ b/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua @@ -10,21 +10,21 @@ local lexer = lexer local token = lexer.token local P = lpeg.P -local xmlcdatalexer = { _NAME = "xmlcdata" } +local xmlcdatalexer = { _NAME = "xml-cdata" } +local whitespace = lexer.WHITESPACE -- triggers states +local context = lexer.context -local whitespace = lexer.WHITESPACE -- triggers states +local space = lexer.space +local nospace = 1 - space - P("]]>") -local space = lexer.space -local nospace = 1 - space - P("]]>") - -local p_spaces = token(whitespace, space ^1) -local p_cdata = token("comment", nospace^1) +local p_spaces = token(whitespace, space ^1) +local p_cdata = token("comment", nospace^1) xmlcdatalexer._rules = { { "whitespace", p_spaces }, { "cdata", p_cdata }, } -xmlcdatalexer._tokenstyles = lexer.context.styleset +xmlcdatalexer._tokenstyles = context.styleset return xmlcdatalexer diff --git a/context/data/scite/lexers/scite-context-lexer-xml-comment.lua b/context/data/scite/lexers/scite-context-lexer-xml-comment.lua index 151270091..f2e24fa90 100644 --- a/context/data/scite/lexers/scite-context-lexer-xml-comment.lua +++ b/context/data/scite/lexers/scite-context-lexer-xml-comment.lua @@ -10,9 +10,9 @@ local lexer = lexer local token = lexer.token local P = lpeg.P -local xmlcommentlexer = { _NAME = "xmlcomment" } - -local whitespace = lexer.WHITESPACE +local xmlcommentlexer = { _NAME = "xml-comment" } +local whitespace = lexer.WHITESPACE +local context = lexer.context local space = lexer.space local nospace = 1 - space - P("-->") @@ -25,7 +25,7 @@ xmlcommentlexer._rules = { { "comment", p_comment }, } -xmlcommentlexer._tokenstyles = lexer.context.styleset +xmlcommentlexer._tokenstyles = context.styleset xmlcommentlexer._foldsymbols = { _patterns = { diff --git a/context/data/scite/lexers/scite-context-lexer-xml.lua b/context/data/scite/lexers/scite-context-lexer-xml.lua index b74a43cc7..d938840c0 100644 --- a/context/data/scite/lexers/scite-context-lexer-xml.lua +++ b/context/data/scite/lexers/scite-context-lexer-xml.lua @@ -22,12 +22,12 @@ local type = type local match, find = string.match, string.find local xmllexer = { _NAME = "xml" } -local xmlcommentlexer = lexer.load("scite-context-lexer-xml-comment") -- indirect (some issue with the lexer framework) -local xmlcdatalexer = lexer.load("scite-context-lexer-xml-cdata") -- indirect (some issue with the lexer framework) - local whitespace = lexer.WHITESPACE -- triggers states local context = lexer.context +local xmlcommentlexer = lexer.load("scite-context-lexer-xml-comment") -- indirect (some issue with the lexer framework) +local xmlcdatalexer = lexer.load("scite-context-lexer-xml-cdata") -- indirect (some issue with the lexer framework) + local space = lexer.space -- S(" \t\n\r\v\f") local any = lexer.any -- P(1) @@ -95,7 +95,8 @@ local p_word = if validwords then return checkedword(validwords,s,i) else - return true, { "text", i } + return true, { "text", i } -- or default +-- return true, { "invisible", i } end end) @@ -107,6 +108,7 @@ local p_text = local p_spacing = token(whitespace, space^1) +-- token("whitespace", space^1) local p_optionalwhitespace = p_spacing^0 @@ -225,23 +227,29 @@ local p_doctype = token("command",P("<!DOCTYPE")) lexer.embed_lexer(xmllexer, xmlcommentlexer, token("command",opencomment), token("command",closecomment)) lexer.embed_lexer(xmllexer, xmlcdatalexer, token("command",opencdata), token("command",closecdata)) -local p_name = - token("plain",name) - * ( - token("default",colon) - * token("keyword",name) - )^1 - + token("keyword",name) - -local p_key = p_name +-- local p_name = +-- token("plain",name) +-- * ( +-- token("default",colon) +-- * token("keyword",name) +-- ) +-- + token("keyword",name) + +local p_name = -- more robust + token("plain",name * colon)^-1 + * token("keyword",name) + +-- local p_key = +-- token("plain",name) +-- * ( +-- token("default",colon) +-- * token("constant",name) +-- ) +-- + token("constant",name) local p_key = - token("plain",name) - * ( - token("default",colon) - * token("constant",name) - )^1 - + token("constant",name) + token("plain",name * colon)^-1 + * token("constant",name) local p_attributes = ( p_optionalwhitespace @@ -255,16 +263,24 @@ local p_attributes = ( local p_open = token("keyword",openbegin) - * p_name - * p_optionalwhitespace - * p_attributes - * token("keyword",closebegin) + * ( + p_name + * p_optionalwhitespace + * p_attributes + * token("keyword",closebegin) + + + token("error",(1-closebegin)^1) + ) local p_close = token("keyword",openend) - * p_name - * p_optionalwhitespace - * token("keyword",closeend) + * ( + p_name + * p_optionalwhitespace + * token("keyword",closeend) + + + token("error",(1-closeend)^1) + ) local p_entity = token("constant",entity) diff --git a/context/data/scite/lexers/scite-context-lexer.lua b/context/data/scite/lexers/scite-context-lexer.lua index 2d1e8b205..d82a057b7 100644 --- a/context/data/scite/lexers/scite-context-lexer.lua +++ b/context/data/scite/lexers/scite-context-lexer.lua @@ -243,6 +243,7 @@ patterns.wordpattern = patterns.wordtoken^3 -- todo: if limit and #s < limit the function context.checkedword(validwords,s,i) -- ,limit if not validwords then return true, { "text", i } +-- return true, { "default", i } else -- keys are lower local word = validwords[s] diff --git a/context/data/scite/lexers/themes/scite-context-theme.lua b/context/data/scite/lexers/themes/scite-context-theme.lua index fed7b0853..6351c290d 100644 --- a/context/data/scite/lexers/themes/scite-context-theme.lua +++ b/context/data/scite/lexers/themes/scite-context-theme.lua @@ -83,6 +83,7 @@ local style_regex = style { fore = colors.magenta } -- reserved: local style_default = style { font = font_name, size = font_size, fore = colors.black, back = colors.textpanel } +local style_text = style { font = font_name, size = font_size, fore = colors.black, back = colors.textpanel } local style_line_number = style { back = colors.linepanel } local style_bracelight = style { fore = colors.orange, bold = true } local style_bracebad = style { fore = colors.orange, bold = true } @@ -176,6 +177,8 @@ local styles = { -- as we have globals we could do with less ["user"] = style_user, ["data"] = style_data, + ["text"] = style_text, -- style_default + } local styleset = { } diff --git a/context/data/scite/scite-context-external.properties b/context/data/scite/scite-context-external.properties index d0e6fc9c5..6bba2b7ff 100644 --- a/context/data/scite/scite-context-external.properties +++ b/context/data/scite/scite-context-external.properties @@ -39,6 +39,15 @@ lexer.$(file.patterns.example)=lpeg_scite-context-lexer-xml lexer.$(file.patterns.text)=lpeg_scite-context-lexer-txt lexer.$(file.patterns.pdf)=lpeg_scite-context-lexer-pdf +#~ lexer.$(file.patterns.metapost)=lpeg_ctx-mps +#~ lexer.$(file.patterns.metafun)=lpeg_ctx-mps +#~ lexer.$(file.patterns.context)=lpeg_ctx-tex +#~ lexer.$(file.patterns.tex)=lpeg_ctx-tex +#~ lexer.$(file.patterns.lua)=lpeg_ctx-lua +#~ lexer.$(file.patterns.example)=lpeg_ctx-xml +#~ lexer.$(file.patterns.text)=lpeg_ctx-txt +#~ lexer.$(file.patterns.pdf)=lpeg_ctx-pdf + comment.block.lpeg_scite-context-lexer-tex=% comment.block.at.line.start.lpeg_scite-context-lexer-tex=1 @@ -54,6 +63,21 @@ comment.block.at.line.start.lpeg_scite-context-lexer-cld=1 comment.block.lpeg_props=# comment.block.at.line.start.lpeg_props=1 +#~ comment.block.lpeg_ctx-tex=% +#~ comment.block.at.line.start.lpeg_ctx-tex=1 + +#~ comment.block.lpeg_ctx-mps=% +#~ comment.block.at.line.start.lpeg_ctx-mps=1 + +#~ comment.block.lpeg_ctx-lua=-- +#~ comment.block.at.line.start.lpeg_ctx-lua=1 + +#~ comment.block.lpeg_ctx-cld=-- +#~ comment.block.at.line.start.lpeg_ctx-cld=1 + +#~ comment.block.lpeg_props=# +#~ comment.block.at.line.start.lpeg_props=1 + #~ style.*.34=bold #~ style.*.35=bold |