diff options
author | Marius <mariausol@gmail.com> | 2014-01-16 20:00:26 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2014-01-16 20:00:26 +0200 |
commit | 38d38fd1b339c11849273456bd7f8fa86a9f5155 (patch) | |
tree | c36a800638e8fe7d0688a9c18ae9a919f33ec327 | |
parent | 2736c98b75ce6a4741cbf252b8e706e139f536f9 (diff) | |
download | context-38d38fd1b339c11849273456bd7f8fa86a9f5155.tar.gz |
beta 2014.01.16 18:46
-rw-r--r-- | doc/context/manuals/allkind/mkiv-publications.tex | 57 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 14 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 14 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 14 | ||||
-rw-r--r-- | tex/context/base/back-exp.lua | 16 | ||||
-rw-r--r-- | tex/context/base/char-utf.lua | 87 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4086 -> 4085 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/export-example.css | 15 | ||||
-rw-r--r-- | tex/context/base/l-lpeg.lua | 9 | ||||
-rw-r--r-- | tex/context/base/publ-ini.lua | 31 | ||||
-rw-r--r-- | tex/context/base/publ-ini.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24769 -> 24809 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 229144 -> 229023 bytes | |||
-rw-r--r-- | tex/context/base/x-set-11.mkiv | 5 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 10 |
17 files changed, 174 insertions, 104 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.tex b/doc/context/manuals/allkind/mkiv-publications.tex index 49e13d79e..fce992a54 100644 --- a/doc/context/manuals/allkind/mkiv-publications.tex +++ b/doc/context/manuals/allkind/mkiv-publications.tex @@ -23,7 +23,8 @@ css=export-example.css] \setupexport - [hyphen=yes] + [hyphen=yes, + width=60em] % \input publ-tmp.mkiv @@ -650,6 +651,7 @@ subsystem is configurable and extensible. Just look at the following commands: \startlines \getbuffer \stoplines The first argument is optional. +% What is the default? How can one set this up? \showsetup[cite] @@ -672,7 +674,15 @@ Here we sort the authors and color the citation: \startlines \getbuffer \stoplines For reasons of backward compatibility the \type {\cite} command is a bit picky -about spaces between the two arguments, of which the first is optional. +about spaces between the two arguments, of which the first is optional. This is +a consequence of allowing its use with the key specified between curly brackets +as is the traditional practice. (We do encourage users to adopt the more +coherent \CONTEXT\ syntax by using square brackets for keywords and reserving +curly brackets to regroup text to be typeset.) +% Just how is it picky? + +The \type {\citation} command is synonymous but is more flexible with respect to +spacing of its arguments: \starttyping \citation[author] [example::demo-004,demo-003] @@ -680,6 +690,8 @@ about spaces between the two arguments, of which the first is optional. \citation[authoryears][example::demo-004,demo-003] \stoptyping +% The first argument of cite and citation is optional. What is the default and how does one set it? + There is a whole bunch of cite options and more can be easily defined. \startluacode @@ -1040,19 +1052,20 @@ from the contextgarden wiki): \stoptyping For \MKIV\ the modules were partly rewritten and ended up in the core so the two -{\usemodule} commands are not needed there. One advantage of explicitly loading a -module is that a job that doesn't need references to publications doesn't suffer -from the associated overhead. Nowadays this overhead can be neglected. The first -setup command in this example is needed to bootstrap the process: it tells what -database has to be processed by \BIBTEX\ between runs. The second setup command -is optional. Each citation (tagged with \type {\cite}) ends up in the list of -publications. - -In the new approach again the code is in the \CONTEXT\ kernel, so no modules need -to be loaded. But, as we no longer use \BIBTEX, we don't need to setup \BIBTEX. +{\usemodule} commands were no longer needed. The overhead associated with the +automatic loading of the bibliography macros can be neglected these days, so +standardized modules such as \type {bib} are all being moved to the core and do +not need to be explicitly loaded. + +The first \type {\setupbibtex} command in this example is needed to bootstrap +the process: it tells what database has to be processed by \BIBTEX\ between +runs. The second \type {\setuppublications} command is optional. Each citation +(tagged with \type {\cite}) ends up in the list of publications. + +In the new approach we no longer use \BIBTEX so we don't need to setup \BIBTEX. Instead we define dataset(s). We also no longer set up publications with one command, but have split that up in rendering-, list-, and cite|-|variants. The -basic \type {\cite} command remains. +basic \type {\cite} command remains. The above example becomes: \starttyping \definebtxdataset @@ -1077,8 +1090,8 @@ basic \type {\cite} command remains. \stoptext \stoptyping -So, we have a few more commands to set up things. If you use just one dataset -and rendering, the above preamble can be simplified to: +So, we have a few more commands to set up things. If you intend to use just a +single dataset and rendering, the above preamble can be simplified to: \starttyping \usebtxdataset @@ -1088,14 +1101,14 @@ and rendering, the above preamble can be simplified to: [numbering=yes] \stoptyping -But keep in mind, that compared to the old \MKII\ derived method we have moved -some of the setup options to setting up the list and cite variants. +But keep in mind that compared to the old \MKII\ derived method we have moved +some of the options to the rendering, list and cite setup variants. -Another difference is the use of lists. When you define a rendering, you also -define a list. However, all entries are collected in a common list tagged \type -{btx}. Although you will normally configure a rendering you can still set some -properties of lists, but in that case you need to prefix the list identifier. In -the case of the above example this is \type {btx:document}. +Another difference is now the use of lists. When you define a rendering, you +also define a list. However, all entries are collected in a common list tagged +\type {btx}. Although you will normally configure a rendering you can still set +some properties of lists, but in that case you need to prefix the list +identifier. In the case of the above example this is \type {btx:document}. \stopchapter diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 455f2e7d3..2ea37d3b9 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 29245, stripped down to: 15964 +-- original size: 29405, stripped down to: 16049 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -744,7 +744,7 @@ function lpeg.replacer(one,two,makefunction,isutf) return pattern end end -function lpeg.finder(lst,makefunction) +function lpeg.finder(lst,makefunction,isutf) local pattern if type(lst)=="table" then pattern=P(false) @@ -760,7 +760,11 @@ function lpeg.finder(lst,makefunction) else pattern=P(lst) end - pattern=(1-pattern)^0*pattern + if isutf then + pattern=((utf8char or 1)-pattern)^0*pattern + else + pattern=(1-pattern)^0*pattern + end if makefunction then return function(str) return lpegmatch(pattern,str) @@ -16683,8 +16687,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 685152 --- stripped bytes : 242401 +-- original bytes : 685312 +-- stripped bytes : 242476 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 455f2e7d3..2ea37d3b9 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 29245, stripped down to: 15964 +-- original size: 29405, stripped down to: 16049 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -744,7 +744,7 @@ function lpeg.replacer(one,two,makefunction,isutf) return pattern end end -function lpeg.finder(lst,makefunction) +function lpeg.finder(lst,makefunction,isutf) local pattern if type(lst)=="table" then pattern=P(false) @@ -760,7 +760,11 @@ function lpeg.finder(lst,makefunction) else pattern=P(lst) end - pattern=(1-pattern)^0*pattern + if isutf then + pattern=((utf8char or 1)-pattern)^0*pattern + else + pattern=(1-pattern)^0*pattern + end if makefunction then return function(str) return lpegmatch(pattern,str) @@ -16683,8 +16687,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 685152 --- stripped bytes : 242401 +-- original bytes : 685312 +-- stripped bytes : 242476 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 455f2e7d3..2ea37d3b9 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true --- original size: 29245, stripped down to: 15964 +-- original size: 29405, stripped down to: 16049 if not modules then modules={} end modules ['l-lpeg']={ version=1.001, @@ -744,7 +744,7 @@ function lpeg.replacer(one,two,makefunction,isutf) return pattern end end -function lpeg.finder(lst,makefunction) +function lpeg.finder(lst,makefunction,isutf) local pattern if type(lst)=="table" then pattern=P(false) @@ -760,7 +760,11 @@ function lpeg.finder(lst,makefunction) else pattern=P(lst) end - pattern=(1-pattern)^0*pattern + if isutf then + pattern=((utf8char or 1)-pattern)^0*pattern + else + pattern=(1-pattern)^0*pattern + end if makefunction then return function(str) return lpegmatch(pattern,str) @@ -16683,8 +16687,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 685152 --- stripped bytes : 242401 +-- original bytes : 685312 +-- stripped bytes : 242476 -- end library merge diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index f51025cf8..d4133396b 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -456,16 +456,24 @@ local function checkdocument(root) local di = data[i] local tg = di.tg if tg == "noexport" then -data[i] = false --- di.element = "" --- di.data = nil -- { } + local ud = userdata[di.fulltag] + local comment = ud and ud.comment + if comment then + di.element = "comment" + di.data = { { content = comment } } + ud.comment = nil + else + data[i] = false + -- di.element = "" + -- di.data = nil + end elseif di.content then -- okay elseif tg == "ignore" then di.element = "" checkdocument(di) else -checkdocument(di) + checkdocument(di) -- new, else no noexport handling end end end diff --git a/tex/context/base/char-utf.lua b/tex/context/base/char-utf.lua index 95ed48279..d406b8bfe 100644 --- a/tex/context/base/char-utf.lua +++ b/tex/context/base/char-utf.lua @@ -357,44 +357,55 @@ function utffilters.collapse(str,filename) -- we can make high a seperate pass return str end -function utffilters.decompose(str) - if str and str ~= "" then - local nstr = #str - if nstr > 1 then - -- if initialize then -- saves a call - -- initialize() - -- end - local tokens, t, done, n = { }, 0, false, 0 - for s in utfcharacters(str) do - local dec = decomposed[s] - if dec then - if not done then - if n > 0 then - for s in utfcharacters(str) do - if n == 1 then - break - else - t = t + 1 - tokens[t] = s - n = n - 1 - end - end - end - done = true - end - t = t + 1 - tokens[t] = dec - elseif done then - t = t + 1 - tokens[t] = s - else - n = n + 1 - end - end - if done then - return concat(tokens) -- seldom called - end - end +-- function utffilters.decompose(str) +-- if str and str ~= "" then +-- local nstr = #str +-- if nstr > 1 then +-- -- if initialize then -- saves a call +-- -- initialize() +-- -- end +-- local tokens, t, done, n = { }, 0, false, 0 +-- for s in utfcharacters(str) do +-- local dec = decomposed[s] +-- if dec then +-- if not done then +-- if n > 0 then +-- for s in utfcharacters(str) do +-- if n == 0 then +-- break +-- else +-- t = t + 1 +-- tokens[t] = s +-- n = n - 1 +-- end +-- end +-- end +-- done = true +-- end +-- t = t + 1 +-- tokens[t] = dec +-- elseif done then +-- t = t + 1 +-- tokens[t] = s +-- else +-- n = n + 1 +-- end +-- end +-- if done then +-- return concat(tokens) -- seldom called +-- end +-- end +-- end +-- return str +-- end + +local tree = lpeg.utfchartabletopattern(table.keys(decomposed)) +local finder = lpeg.finder(tree,false,true) +local replacer = lpeg.replacer(tree,decomposed,false,true) + +function utffilters.decompose(str) -- 3 to 4 times faster than the above + if str and str ~= "" and #str > 1 and lpegmatch(finder,str) then + return lpegmatch(replacer,str) end return str end diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 19261b64c..8882d6b54 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.01.15 18:03} +\newcontextversion{2014.01.16 18:46} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 7541feadb..5a9db5b1b 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 3dd862759..5f05d3318 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.01.15 18:03} +\edef\contextversion{2014.01.16 18:46} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/export-example.css b/tex/context/base/export-example.css index 06d51c587..dbecc01fe 100644 --- a/tex/context/base/export-example.css +++ b/tex/context/base/export-example.css @@ -709,3 +709,18 @@ a[href]:hover { color : rgb(50%,0%,0%) ; text-decoration : underline ; } + +/* setups */ + +setup { + display : block ; +} + +comment { + background-color : rgb(50%,75%,100%) ; + display : block ; + padding : 1em ; + margin-bottom : 1em ; + margin-top : 1em ; + font-family : "Lucida Console", "DejaVu Sans Mono", monospace ; +} diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 399b3ad65..bad90efa8 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -469,7 +469,7 @@ end -- local pattern1 = P(1-P(pattern))^0 * P(pattern) : test for not nil -- local pattern2 = (P(pattern) * Cc(true) + P(1))^0 : test for true (could be faster, but not much) -function lpeg.finder(lst,makefunction) -- beware: slower than find with 'patternless finds' +function lpeg.finder(lst,makefunction,isutf) -- beware: slower than find with 'patternless finds' local pattern if type(lst) == "table" then pattern = P(false) @@ -485,7 +485,12 @@ function lpeg.finder(lst,makefunction) -- beware: slower than find with 'pattern else pattern = P(lst) end - pattern = (1-pattern)^0 * pattern + if isutf then +-- pattern = ((utf8char or 1)-pattern)^0 * pattern + pattern = ((utf8char or 1)-pattern)^0 * pattern + else + pattern = (1-pattern)^0 * pattern + end if makefunction then return function(str) return lpegmatch(pattern,str) diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index a791f4726..ceaeab0ee 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -841,8 +841,7 @@ function lists.resolve(dataset,reference) -- maybe already feed it split for rest in gmatch(reference,"[^, ]+") do local blk, tag, found = block, nil, nil if block then --- tag = blk .. ":" .. rest - tag = dataset .. ":" .. blk .. ":" .. rest + tag = f_destination(dataset,blk,rest) found = subset[tag] if not found then for i=block-1,1,-1 do @@ -857,7 +856,7 @@ function lists.resolve(dataset,reference) -- maybe already feed it split end if not found then blk = "*" - tag = dataset .. ":" .. blk .. ":" .. rest + tag = f_destination(dataset,blk,rest) found = subset[tag] end if found then @@ -1022,7 +1021,7 @@ function commands.btxhandlecite(dataset,tag,mark,variant,sorttype,setup) -- vari if i > 1 then context.btxcitevariantparameter(v_middle) end - if mark then + if mark ~= false then context.dobtxmarkcitation(dataset,tag) end context.formatted.directsetup(setup) -- cite can become alternative @@ -1033,17 +1032,19 @@ function commands.btxhandlecite(dataset,tag,mark,variant,sorttype,setup) -- vari end end -function commands.btxhandlenocite(dataset,tag) - local prefix, rest = lpegmatch(splitter,tag) - if rest then - dataset = prefix - else - rest = tag - end - context.setvalue("currentbtxdataset",dataset) - local tags = settings_to_array(rest) - for i=1,#tags do - context.dobtxmarkcitation(dataset,tags[i]) +function commands.btxhandlenocite(dataset,tag,mark) + if mark ~= false then + local prefix, rest = lpegmatch(splitter,tag) + if rest then + dataset = prefix + else + rest = tag + end + context.setvalue("currentbtxdataset",dataset) + local tags = settings_to_array(rest) + for i=1,#tags do + context.dobtxmarkcitation(dataset,tags[i]) + end end end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index dafb0dca3..8279e2a78 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -672,7 +672,7 @@ \unexpanded\def\publ_cite_no[#1]% {\iftrialtypesetting \else - \ctxcommand{btxhandlenocite("\currentbtxdataset","#1")}% + \ctxcommand{btxhandlenocite("\currentbtxdataset","#1",true)}% \fi} %D Compatibility: diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 619c76e8a..2f68708da 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 04eb97fb9..80538ebc1 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/x-set-11.mkiv b/tex/context/base/x-set-11.mkiv index 8380c9f80..12854dc92 100644 --- a/tex/context/base/x-set-11.mkiv +++ b/tex/context/base/x-set-11.mkiv @@ -451,11 +451,12 @@ % \def\showsetupindeed#1% % {\xmlfilterlist{\loadedsetups}{/interface/command['#1' == (@type=='environment' and 'start' or '') .. @name]/command(xml:setups:typeset)}} -\setelementnature[setup][display] +% \setelementnature[setup][display] +% \setelementnature[setup][mixed] \def\showsetupindeed#1% {\startelement[setup][name=#1]% - \startelement[noexport]% + \startelement[noexport][comment={setup definition #1}] \xmlfilterlist{\loadedsetups}{/interface/command['#1' == (@type=='environment' and 'start' or '') .. @name]/command(xml:setups:typeset)}% \stopelement \stopelement} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 6af830035..3e612d926 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 01/15/14 18:03:19 +-- merge date : 01/16/14 18:46:41 do -- begin closure to overcome local limits and interference @@ -395,7 +395,7 @@ function lpeg.replacer(one,two,makefunction,isutf) return pattern end end -function lpeg.finder(lst,makefunction) +function lpeg.finder(lst,makefunction,isutf) local pattern if type(lst)=="table" then pattern=P(false) @@ -411,7 +411,11 @@ function lpeg.finder(lst,makefunction) else pattern=P(lst) end - pattern=(1-pattern)^0*pattern + if isutf then + pattern=((utf8char or 1)-pattern)^0*pattern + else + pattern=(1-pattern)^0*pattern + end if makefunction then return function(str) return lpegmatch(pattern,str) |