diff options
Diffstat (limited to 'Master/texmf-dist/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua')
-rw-r--r-- | Master/texmf-dist/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/Master/texmf-dist/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua b/Master/texmf-dist/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua index f205e913053..7097c41a68d 100644 --- a/Master/texmf-dist/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua +++ b/Master/texmf-dist/context/data/scite/lexers/scite-context-lexer-pdf-xref.lua @@ -6,44 +6,36 @@ local info = { license = "see context related readme files", } -local lexer = lexer -local token = lexer.token -local P, R = lpeg.P, lpeg.R +-- no longer used: nesting lexers with whitespace in start/stop is unreliable --- xref --- cardinal cardinal [character] --- .. --- %%EOF | startxref | trailer +local P, R = lpeg.P, lpeg.R -local pdfxreflexer = { _NAME = "pdf-xref", _FILENAME = "scite-context-lexer-pdf-xref" } -local whitespace = lexer.WHITESPACE -- triggers states +local lexer = require("lexer") local context = lexer.context local patterns = context.patterns -local pdfobjectlexer = lexer.load("scite-context-lexer-pdf-object") +local token = lexer.token + +local pdfxreflexer = lexer.new("pdfxref","scite-context-lexer-pdf-xref") +local whitespace = pdfxreflexer.whitespace local spacing = patterns.spacing +local cardinal = patterns.cardinal +local alpha = patterns.alpha local t_spacing = token(whitespace, spacing) -local p_trailer = P("trailer") - -local t_number = token("number", R("09")^1) - * t_spacing - * token("number", R("09")^1) - * t_spacing - * (token("keyword", R("az","AZ")) * t_spacing)^-1 - -local t_xref = t_number^1 +local p_xref = P("xref") +local t_xref = token("keyword",p_xref) + * token("number", cardinal * spacing * cardinal * spacing) --- local t_xref = token("default", (1-p_trailer)^1) --- * token("keyword", p_trailer) --- * t_spacing --- * pdfobjectlexer._shared.dictionary +local t_number = token("number", cardinal * spacing * cardinal * spacing) + * token("keyword", alpha) pdfxreflexer._rules = { - { 'whitespace', t_spacing }, - { 'xref', t_xref }, + { "whitespace", t_spacing }, + { "xref", t_xref }, + { "number", t_number }, } pdfxreflexer._tokenstyles = context.styleset |