diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-03-16 23:13:12 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-03-16 23:13:12 +0100 |
commit | 37c561c2f98d84fc02011b7b819ae8cf9bb4b10d (patch) | |
tree | 2fabea24c6495db294d24e9c8d56eb88158005c9 | |
parent | a4e07f30e880ab27c2918f81f136e257475b7729 (diff) | |
download | context-37c561c2f98d84fc02011b7b819ae8cf9bb4b10d.tar.gz |
2018-03-16 22:29:00
29 files changed, 185 insertions, 117 deletions
diff --git a/context/data/scite/context/lexers/scite-context-lexer-bnf.lua b/context/data/scite/context/lexers/scite-context-lexer-bnf.lua new file mode 100644 index 000000000..ce57642ba --- /dev/null +++ b/context/data/scite/context/lexers/scite-context-lexer-bnf.lua @@ -0,0 +1,99 @@ +local info = { + version = 1.001, + comment = "scintilla lpeg lexer for bnf", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- will replace the one in metafun + +local global, lpeg = _G, lpeg +local P, R, S = lpeg.P, lpeg.R, lpeg.S + +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 bnflexer = lexer.new("bnf","scite-context-lexer-bnf") +local whitespace = bnflexer.whitespace + +-- from wikipedia: +-- +-- <syntax> ::= <rule> | <rule> <syntax> +-- <rule> ::= <opt-whitespace> "<" <rule-name> ">" <opt-whitespace> "::=" <opt-whitespace> <expression> <line-end> +-- <opt-whitespace> ::= " " <opt-whitespace> | "" +-- <expression> ::= <list> | <list> <opt-whitespace> "|" <opt-whitespace> <expression> +-- <line-end> ::= <opt-whitespace> <EOL> | <line-end> <line-end> +-- <list> ::= <term> | <term> <opt-whitespace> <list> +-- <term> ::= <literal> | "<" <rule-name> ">" +-- <literal> ::= '"' <text1> '"' | "'" <text2> "'" +-- <text1> ::= "" | <character1> <text1> +-- <text2> ::= "" | <character2> <text2> +-- <character> ::= <letter> | <digit> | <symbol> +-- <letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" +-- <digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" +-- <symbol> ::= "|" | " " | "-" | "!" | "#" | "$" | "%" | "&" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | ">" | "=" | "<" | "?" | "@" | "[" | "\" | "]" | "^" | "_" | "`" | "{" | "}" | "~" +-- <character1> ::= <character> | "'" +-- <character2> ::= <character> | '"' +-- <rule-name> ::= <letter> | <rule-name> <rule-char> +-- <rule-char> ::= <letter> | <digit> | "-" + +local anything = patterns.anything +local separator = P("|") +local left = P("<") +local right = P(">") +local space = S(" \t\n\r\f") +local spaces = space^1 +local letter = R("AZ","az") +local digit = R("09") +local symbol = S([[| -!#$%&()*+,-./:;>=<?@[\]^_`{}~]]) +local text = (letter + digit + symbol^0) +local name = letter * (letter + digit + P("-"))^0 +local becomes = P("::=") +local extra = P("|") +local single = P("'") +local double = P('"') + +local t_spacing = token(whitespace,space^1) +local t_term = token("command",left) + * token("text",name) + * token("command",right) +local t_text = token("quote",single) + * token("text",text) + * token("quote",single) + + token("quote",double) + * token("text",text) + * token("quote",double) +local t_becomes = token("operator",becomes) +local t_extra = token("extra",extra) +local t_rest = token("default",anything) + +bnflexer._rules = { + { "whitespace", t_spacing }, + { "term", t_term }, + { "text", t_text }, + { "becomes", t_becomes }, + { "extra", t_extra }, + { "rest", t_rest }, +} + +bnflexer._tokenstyles = context.styleset + +bnflexer._foldpattern = left + right + +bnflexer._foldsymbols = { + _patterns = { + "<", + ">", + }, + ["grouping"] = { + ["<"] = 1, + [">"] = -1, + }, +} + +return bnflexer diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex c19e41f5d..7f73888b2 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex 1ed303414..e95f798bf 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex 20a83a632..7b808f8da 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex 50e0f897e..7e82d88c9 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 1d5903d15..fcecfbcac 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf Binary files differindex b3f4e0e36..285347420 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf Binary files differindex ca4e724e9..56f7170da 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf Binary files differindex cf1afaa70..b9a6da180 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf Binary files differindex 5726a5536..98c96cd82 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf Binary files differindex 0e7b84627..fefbe6ceb 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf Binary files differindex aa314decf..b60af34d4 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf Binary files differindex aedba70db..c66413500 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex 70aadea90..5fbbd909d 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex a876a8a99..9e5810ceb 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 30c27eb44..0c189965f 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.03.15 15:27} +\newcontextversion{2018.03.16 22:20} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index dfa109af4..2dcc7482e 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.03.15 15:27} +\edef\contextversion{2018.03.16 22:20} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 3951d8e3f..aef280dc3 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.03.15 15:27} +\newcontextversion{2018.03.16 22:20} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 6a3eddf9f..1ff75e083 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.03.15 15:27} +\edef\contextversion{2018.03.16 22:20} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua index 1f9fd1ac1..9037939df 100644 --- a/tex/context/base/mkiv/font-otj.lua +++ b/tex/context/base/mkiv/font-otj.lua @@ -34,13 +34,20 @@ if not nodes.properties then return end local next, rawget, tonumber = next, rawget, tonumber local fastcopy = table.fastcopy -local registertracker = trackers.register +local registertracker = trackers.register +local registerdirective = directives.register local trace_injections = false registertracker("fonts.injections", function(v) trace_injections = v end) local trace_marks = false registertracker("fonts.injections.marks", function(v) trace_marks = v end) local trace_cursive = false registertracker("fonts.injections.cursive", function(v) trace_cursive = v end) local trace_spaces = false registertracker("fonts.injections.spaces", function(v) trace_spaces = v end) +-- local fix_cursive_marks = false +-- +-- registerdirective("fonts.injections.fixcursivemarks", function(v) +-- fix_cursive_marks = v +-- end) + local report_injections = logs.reporter("fonts","injections") local report_spaces = logs.reporter("fonts","spaces") @@ -1033,6 +1040,8 @@ local function inject_everything(head,where) local marks = { } local nofmarks = 0 -- + -- local applyfix = hascursives and fix_cursive_marks + -- -- move out -- local function processmark(p,n,pn) -- p = basenode @@ -1118,7 +1127,7 @@ local function inject_everything(head,where) end end -- begin of temp fix -- - local base = nil -- bah, some arabic fonts have no mark anchoring + -- local base = nil -- bah, some arabic fonts have no mark anchoring -- end of temp fix -- while current do local next = getnext(current) @@ -1126,62 +1135,62 @@ local function inject_everything(head,where) if char then local p = rawget(properties,current) -- begin of temp fix -- - if hascursives then - if not p then - local m = fontmarks[getfont(current)] - if m and m[char] then - if base then - p = { injections = { markbasenode = base } } - nofmarks = nofmarks + 1 - marks[nofmarks] = current - properties[current] = p - hasmarks = true - end - else - base = current - end - end - end + -- if applyfix then + -- if not p then + -- local m = fontmarks[getfont(current)] + -- if m and m[char] then + -- if base then + -- p = { injections = { markbasenode = base } } + -- nofmarks = nofmarks + 1 + -- marks[nofmarks] = current + -- properties[current] = p + -- hasmarks = true + -- end + -- else + -- base = current + -- end + -- end + -- end -- end of temp fix if p then local i = p.injections -- begin of temp fix -- - if hascursives then - if not i then - local m = fontmarks[getfont(current)] - if m and m[char] then - if base then - i = { markbasenode = base } - nofmarks = nofmarks + 1 - marks[nofmarks] = current - p.injections = i - hasmarks = true - end - else - base = current - end - end - end + -- if applyfix then + -- if not i then + -- local m = fontmarks[getfont(current)] + -- if m and m[char] then + -- if base then + -- i = { markbasenode = base } + -- nofmarks = nofmarks + 1 + -- marks[nofmarks] = current + -- p.injections = i + -- hasmarks = true + -- end + -- else + -- base = current + -- end + -- end + -- end -- end of temp fix -- if i then local pm = i.markbasenode -- begin of temp fix -- - if hascursives then - if not pm then - local m = fontmarks[getfont(current)] - if m and m[char] then - if base then - pm = base - i.markbasenode = pm - hasmarks = true - end - else - base = current - end - else - base = current - end - end + -- if applyfix then + -- if not pm then + -- local m = fontmarks[getfont(current)] + -- if m and m[char] then + -- if base then + -- pm = base + -- i.markbasenode = pm + -- hasmarks = true + -- end + -- else + -- base = current + -- end + -- else + -- base = current + -- end + -- end -- end of temp fix -- if pm then nofmarks = nofmarks + 1 @@ -1326,9 +1335,11 @@ local function inject_everything(head,where) prevdisc = nil prevglyph = current elseif char == false then + -- base = nil prevdisc = nil prevglyph = current elseif id == disc_code then + -- base = nil pre, post, replace, pretail, posttail, replacetail = getdisc(current,true) local done = false if pre then @@ -1460,9 +1471,9 @@ local function inject_everything(head,where) prevglyph = nil prevdisc = current else + -- base = nil prevglyph = nil prevdisc = nil -base = nil end prev = current current = next diff --git a/tex/context/base/mkiv/page-ini.lua b/tex/context/base/mkiv/page-ini.lua index 17723c421..6325e1d39 100644 --- a/tex/context/base/mkiv/page-ini.lua +++ b/tex/context/base/mkiv/page-ini.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['page-ini'] = { license = "see context related readme files" } -local tonumber, rawget, type, next = tonumber, rawget, type, next +local tonumber, rawget, rawset, type, next = tonumber, rawget, rawset, type, next local match = string.match local sort, tohash, insert, remove = table.sort, table.tohash, table.insert, table.remove local settings_to_array, settings_to_hash = utilities.parsers.settings_to_array, utilities.parsers.settings_to_hash @@ -14,7 +14,7 @@ local settings_to_array, settings_to_hash = utilities.parsers.settings_to_array, local texgetcount = tex.getcount local context = context -local ctx_testcase = commands.testcase +local ctx_doifelse = commands.doifelse local data = table.setmetatableindex("table") local last = 0 @@ -69,13 +69,14 @@ function pages.mark(name,list) end end -function pages.marked(name) +local function marked(name) local realpage = texgetcount("realpageno") for i=last,realpage-1 do - data[i] = nil + rawset(data,i,nil) end local pagedata = rawget(data,realpage) - return pagedata and pagedata[name] + print(pagedata and pagedata[name] and true or false) + return pagedata and pagedata[name] and true or false end local function toranges(marked) @@ -97,8 +98,6 @@ local function toranges(marked) return list end -pages.toranges = toranges - local function allmarked(list) if list then local collected = pages.collected @@ -139,6 +138,8 @@ local function allmarked(list) end end +pages.marked = marked +pages.toranges = toranges pages.allmarked = allmarked -- An alternative is to use an attribute and identify the state by parsing the node @@ -170,7 +171,7 @@ interfaces.implement { interfaces.implement { name = "doifelsemarkedpage", arguments = "string", - actions = { marked, ctx_testcase } + actions = { marked, ctx_doifelse } } interfaces.implement { diff --git a/tex/context/base/mkiv/page-set.mkiv b/tex/context/base/mkiv/page-set.mkiv index fb6f607a1..3579e3b48 100644 --- a/tex/context/base/mkiv/page-set.mkiv +++ b/tex/context/base/mkiv/page-set.mkiv @@ -1198,12 +1198,12 @@ {\OTRSETcheckprefered \enoughcolumncellsfalse \donefalse - \dostepwiserecurse{#1}{#2}{#3#4} + \dostepwiserecurse{#1}{#2}{#31} {\ifdone \exitloop \else #4=\recurselevel - \dostepwiserecurse{#5}{#6}{#7#8} + \dostepwiserecurse{#5}{#6}{#71} {\ifdone \exitloop \else diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 1351546fd..531068f8a 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 15354a5ea..22eee2a81 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 20a83a632..7b808f8da 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 14862cbb6..aad96f1a7 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv index 12b54b9ac..48f1022ad 100644 --- a/tex/context/modules/mkiv/m-scite.mkiv +++ b/tex/context/modules/mkiv/m-scite.mkiv @@ -294,7 +294,8 @@ visualizers.register("btx", visualizer) visualizers.register("web", visualizer) visualizers.register("cpp", visualizer) visualizers.register("txt", visualizer) ------------.register("sql", visualizer) +visualizers.register("bnf", visualizer) +visualizers.register("sql", visualizer) \stopluacode @@ -306,6 +307,8 @@ visualizers.register("txt", visualizer) \definetyping[CPP] [option=web] \definetyping[WEB] [option=web] \definetyping[TXT] [option=txt] +\definetyping[BNF] [option=bnf] % I might use this in the metafun manual. +\definetyping[SQL] [option=sql] % To be tested in an upcoming manual. \definetyping[NONE][option=none] % This is a preliminary interface. diff --git a/tex/context/modules/mkiv/s-fonts-variable.mkiv b/tex/context/modules/mkiv/s-fonts-variable.mkiv index 5c9d53d33..d1bf8b69d 100644 --- a/tex/context/modules/mkiv/s-fonts-variable.mkiv +++ b/tex/context/modules/mkiv/s-fonts-variable.mkiv @@ -107,4 +107,7 @@ \showfontvariations [font=file:bahnschrift.ttf] + % \showfontvariations + % [font=file:sitka.ttc] + \stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 96398dcc0..e91fdbd93 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 03/15/18 15:27:14 +-- merge date : 03/16/18 22:20:58 do -- begin closure to overcome local limits and interference @@ -21208,6 +21208,7 @@ if not nodes.properties then return end local next,rawget,tonumber=next,rawget,tonumber local fastcopy=table.fastcopy local registertracker=trackers.register +local registerdirective=directives.register local trace_injections=false registertracker("fonts.injections",function(v) trace_injections=v end) local trace_marks=false registertracker("fonts.injections.marks",function(v) trace_marks=v end) local trace_cursive=false registertracker("fonts.injections.cursive",function(v) trace_cursive=v end) @@ -22161,64 +22162,15 @@ local function inject_everything(head,where) showoffset(n,true) end end - local base=nil while current do local next=getnext(current) local char,id=ischar(current) if char then local p=rawget(properties,current) - if hascursives then - if not p then - local m=fontmarks[getfont(current)] - if m and m[char] then - if base then - p={ injections={ markbasenode=base } } - nofmarks=nofmarks+1 - marks[nofmarks]=current - properties[current]=p - hasmarks=true - end - else - base=current - end - end - end if p then local i=p.injections - if hascursives then - if not i then - local m=fontmarks[getfont(current)] - if m and m[char] then - if base then - i={ markbasenode=base } - nofmarks=nofmarks+1 - marks[nofmarks]=current - p.injections=i - hasmarks=true - end - else - base=current - end - end - end if i then local pm=i.markbasenode - if hascursives then - if not pm then - local m=fontmarks[getfont(current)] - if m and m[char] then - if base then - pm=base - i.markbasenode=pm - hasmarks=true - end - else - base=current - end - else - base=current - end - end if pm then nofmarks=nofmarks+1 marks[nofmarks]=current @@ -22489,7 +22441,6 @@ local function inject_everything(head,where) else prevglyph=nil prevdisc=nil -base=nil end prev=current current=next |