"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/plugins/cpp_syslog.lua" (12 May 2020, 1493 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 --[[
    2 
    3 Sample plugin file for highlight 3.1
    4 
    5 Adds additional keywords to C++ syntax description and corresponding
    6 formatting in colour theme
    7 
    8 USAGE: highlight -I main.cpp --plug-in=plugin.lua
    9 ]]
   10 
   11 Description="Add syslog and kernel log levels to C and C++ keywords"
   12 
   13 Categories = {"c++", "syslog" }
   14 
   15 -- function to update language definition with syslog levels
   16 -- optional parameter: syntax description
   17 function syntaxUpdate(desc)
   18   if desc=="C and C++" then
   19     -- insert syslog level for C and C++
   20     table.insert( Keywords,
   21                   { Id=5, List={"LOG_EMERG", "LOG_CRIT", "LOG_ALERT",
   22                     "LOG_ERR", "LOG_WARNING","LOG_NOTICE","LOG_INFO",
   23                     "LOG_DEBUG",
   24                     "KERN_ERR", "KERN_INFO", "KERN_EMERG", "KERN_ALERT",
   25                     "KERN_CRIT",  "KERN_WARNING",  "KERN_NOTICE",
   26                     "KERN_DEBUG", "KERN_DEFAULT",  "KERN_CONT" }
   27                   } )
   28   end
   29 end
   30 
   31 -- function to update theme definition
   32 -- optional parameter: theme description
   33 function themeUpdate(desc)
   34   --add 5th keyword style for syslog levels defined in  syntaxUpdate()
   35   if #Keywords==4 then
   36     table.insert(Keywords, {Colour= "#ff0000", Bold=true})
   37   end
   38 end
   39 
   40 
   41 --The Plugins array assigns code chunks to themes or language definitions.
   42 --The chunks are interpreted after the theme or lang file were parsed,
   43 --so you can refer to elements of these files
   44 
   45 Plugins={
   46 
   47   { Type="theme", Chunk=themeUpdate },
   48   { Type="lang", Chunk=syntaxUpdate },
   49 
   50 }