"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/plugins/cpp_qt.lua" (12 May 2020, 1291 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. See also the last Fossies "Diffs" side-by-side code changes report for "cpp_qt.lua": 3.53_vs_3.54.

    1 --[[
    2 Sample plugin file for highlight
    3 
    4 Adds additional keywords to C++ syntax description and corresponding
    5 formatting in colour theme
    6 ]]
    7 
    8 Description="Add Qt keywords to C and C++"
    9 
   10 Categories = {"c++", "qt" }
   11 
   12 
   13 -- optional parameter: syntax description
   14 function syntaxUpdate(desc)
   15   if desc=="C and C++" then
   16   -- insert Qt keywords
   17   table.insert( Keywords,
   18                   { Id=1, List={"slots" }
   19                   } )
   20   table.insert( Keywords,
   21                   { Id=2, Regex=[[Q[A-Z]\w+]]
   22                   } )
   23   table.insert( Keywords,
   24                   { Id=5, List={"SIGNAL", "SLOT"}
   25                   } )
   26   table.insert( Keywords,
   27                   { Id=6, Regex=[[Q_[A-Z]+]]
   28                   } )
   29   end
   30 end
   31 
   32 -- optional parameter: theme description
   33 function themeUpdate(desc)
   34   if #Keywords==4 then
   35     table.insert(Keywords, {Colour= Keywords[1].Colour, Italic=true}) -- SIGNAL, SLOT keywords
   36     table.insert(Keywords, {Colour= Keywords[2].Colour, Bold=true})   -- Q_* constants
   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 }