1 -- vim: set ft=lua ts=2 sw=2 et :
2 -- Language definition for PDF files
3 -- Author: Roland Hieber <rohieb@rohieb.name>
6 -- * Does not highlight files with MacOS (CR-only) line endings
7 -- * Does not (yet) highlight inside streams due to limitations in the library
10 Description="Highlighting definitions for the Portable Document Format (PDF)"
16 Prefix=[[%PDF-[0-9]\.[0-9]|%%EOF|xref|startxref|trailer]]
19 -- Comments. But do not match file structure elements.
22 Delimiter={ [[%(?!PDF-[0-9]\.[0-9]|%EOF)]] },
26 -- Numbers: 0.45, +1.34, -.4, 123, 4., and so on.
27 Digits=[[ [-+]?\.[0-9]+|[-+]?[0-9]+\.?[0-9]* ]]
29 -- Strings: (string), <hex> and streams
32 { Open=[[ \( ]], Close=[[ \) ]] },
33 { Open=[[ < ]], Close=[[ > ]] },
34 { Open=[[ ^stream ]], Close=[[ ^endstream ]], Raw=true },
38 -- Note: we highlight dictionary and array syntax as "keywords", so we have to
39 -- include them in Identifiers. This definition basically matches the allowed
40 -- characters for Names. Also, we do not want to match Numbers, Streams,
41 -- References and file structure elements as identifiers
42 Identifiers=[[ (?!%PDF-[0-9]\.[0-9]|%%EOF|xref|startxref|trailer|[0-9]+\s+[0-9]+\s+(R|obj)|[-+]?\.[0-9]+|[-+]?[0-9]+\.?[0-9]*)[^\s\[\]\(\){}<>/%]+ ]]
47 Regex=[[ [0-9]+\s+[0-9]+\s+(obj|R)|endobj]],
50 -- Arrays and Dictionaries
52 Regex=[[ \[|\]|<<|>> ]],
56 Regex=[[ /[^\s\[\]\(\){}<>/%]+ ]],
60 --List={"true", "false", "null"},
61 Regex=[[ true|false|null ]],