Skip to content

Commit

Permalink
[Project] Lua_content: Remebered about booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Jan 3, 2020
1 parent 45265c0 commit edff21d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lualib/lua_content/pdf.lua
Expand Up @@ -166,14 +166,17 @@ local function gen_grammar()
-- Identifier
local id = P{'/' * C((1-(delim + ws))^1) / pdf_id_unescape}

-- Booleans (who care about them?)
local boolean = C(P("true") + P("false"))

-- Stupid references
local ref = lpeg.Ct{lpeg.Cc("%REF%") * C(D^1) * " " * C(D^1) * " " * "R"}

return P{
"EXPR";
EXPR = V("ELT")^0,
ELT = V("ARRAY") + V("DICT") + V("ATOM"),
ATOM = ws^0 * (comment + ref + number + V("STRING") + id) * ws^0,
ATOM = ws^0 * (comment + boolean +ref + number + V("STRING") + id) * ws^0,
DICT = "<<" * lpeg.Cf(lpeg.Ct("") * V("KV_PAIR")^0, rawset) * ">>",
KV_PAIR = lpeg.Cg(id * ws^0 * V("ELT") * ws^0),
ARRAY = "[" * lpeg.Ct(V("ELT")^0) * "]",
Expand Down

0 comments on commit edff21d

Please sign in to comment.