"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/langDefs/pdf.lang" (12 May 2020, 1725 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 -- vim: set ft=lua ts=2 sw=2 et :
    2 -- Language definition for PDF files
    3 -- Author: Roland Hieber <rohieb@rohieb.name>
    4 -- Date: 2013-11-22
    5 -- Known Bugs:
    6 --  * Does not highlight files with MacOS (CR-only) line endings
    7 --  * Does not (yet) highlight inside streams due to limitations in the library
    8 --
    9 
   10 Description="Portable Document Format"
   11 
   12 Categories = {"document"}
   13 
   14 IgnoreCase=false
   15 
   16 -- File Structure
   17 PreProcessor={
   18   Prefix=[[%PDF-[0-9]\.[0-9]|%%EOF|xref|startxref|trailer]]
   19 }
   20 
   21 -- Comments. But do not match file structure elements.
   22 Comments={
   23   { Block=false,
   24     Delimiter={ [[%(?!PDF-[0-9]\.[0-9]|%EOF)]] },
   25   },
   26 }
   27 
   28 -- Numbers: 0.45, +1.34, -.4, 123, 4., and so on.
   29 Digits=[[ [-+]?\.[0-9]+|[-+]?[0-9]+\.?[0-9]* ]]
   30 
   31 -- Strings: (string), <hex> and streams
   32 Strings={
   33   DelimiterPairs= {
   34     { Open=[[ \( ]], Close=[[ \) ]] },
   35     { Open=[[ < ]], Close=[[ > ]] },
   36     { Open=[[ ^stream ]], Close=[[ ^endstream ]], Raw=true },
   37   }
   38 }
   39 
   40 -- Note: we highlight dictionary and array syntax as "keywords", so we have to
   41 -- include them in Identifiers. This definition basically matches the allowed
   42 -- characters for Names. Also, we do not want to match Numbers, Streams,
   43 -- References and file structure elements as identifiers
   44 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\[\]\(\){}<>/%]+ ]]
   45 
   46 Keywords={
   47   -- Indirect Objects
   48   { Id=1,
   49     Regex=[[ [0-9]+\s+[0-9]+\s+(obj|R)|endobj]],
   50     Group=0
   51   },
   52   -- Arrays and Dictionaries
   53   { Id=2,
   54     Regex=[[ \[|\]|<<|>> ]],
   55   },
   56   -- Names
   57   { Id=3,
   58     Regex=[[ /[^\s\[\]\(\){}<>/%]+ ]],
   59   },
   60   -- Constants
   61   { Id=4,
   62     --List={"true", "false", "null"},
   63     Regex=[[ true|false|null ]],
   64   },
   65 }