Ticket #3762: 0001-Initial-support-of-OpenShadingLanguage-highlighting.patch

File 0001-Initial-support-of-OpenShadingLanguage-highlighting.patch, 5.5 KB (added by sergey, 7 years ago)
  • misc/syntax/Makefile.am

    From 0c82d3099476bc814299da810ae1e4ccda453e8f Mon Sep 17 00:00:00 2001
    From: Sergey Sharybin <sergey.vfx@gmail.com>
    Date: Wed, 25 Jan 2017 10:14:23 +0100
    Subject: [PATCH] Initial support of OpenShadingLanguage highlighting
    
    Based on C syntax with some extra keywords gathered from OSL's lexer rules.
    ---
     misc/syntax/Makefile.am |   1 +
     misc/syntax/Syntax.in   |   3 ++
     misc/syntax/osl.syntax  | 139 ++++++++++++++++++++++++++++++++++++++++++++++++
     3 files changed, 143 insertions(+)
     create mode 100644 misc/syntax/osl.syntax
    
    diff --git a/misc/syntax/Makefile.am b/misc/syntax/Makefile.am
    index 4c674a20b..c1a0f2e09 100644
    a b SYNTAXFILES = \ 
    5454        nemerle.syntax          \ 
    5555        nroff.syntax            \ 
    5656        opencl.syntax           \ 
     57        osl.syntax              \ 
    5758        octave.syntax           \ 
    5859        pascal.syntax           \ 
    5960        perl.syntax             \ 
  • misc/syntax/Syntax.in

    diff --git a/misc/syntax/Syntax.in b/misc/syntax/Syntax.in
    index fa8e3d482..11d9ea18e 100644
    a b include opencl.syntax 
    274274file ..\*\\.(ya?ml|YML)$ YAML\sFile 
    275275include yaml.syntax 
    276276 
     277file .\*\\.(osl)$ OSL\sProgram 
     278include osl.syntax 
     279 
    277280file .\* unknown 
    278281include unknown.syntax 
  • new file misc/syntax/osl.syntax

    diff --git a/misc/syntax/osl.syntax b/misc/syntax/osl.syntax
    new file mode 100644
    index 000000000..e8607c03f
    - +  
     1# Syntax rules for the C and the C++ programming languages 
     2# 
     3# List of keywords is based on opencl-mode.el from 
     4# Salmane Bah <salmane.bah@u-bordeaux.fr> 
     5 
     6context default 
     7# Keywords 
     8    keyword whole break yellow 
     9    keyword whole closure yellow 
     10    keyword whole color yellow 
     11    keyword whole continue yellow 
     12    keyword whole do yellow 
     13    keyword whole else yellow 
     14    keyword whole float yellow 
     15    keyword whole for yellow 
     16    keyword whole if yellow 
     17    keyword whole illuminance yellow 
     18    keyword whole illuminate yellow 
     19    keyword whole int yellow 
     20    keyword whole matrix yellow 
     21    keyword whole normal yellow 
     22    keyword whole output yellow 
     23    keyword whole point yellow 
     24    keyword whole public yellow 
     25    keyword whole return yellow 
     26    keyword whole string yellow 
     27    keyword whole struct yellow 
     28    keyword whole vector yellow 
     29    keyword whole void yellow 
     30    keyword whole while yellow 
     31    keyword whole or yellow 
     32    keyword whole and yellow 
     33    keyword whole not yellow 
     34    keyword whole linestart \{\s\t\}\[\s\t\]#*\n brightmagenta 
     35 
     36# Reserved words 
     37    keyword whole bool red 
     38    keyword whole case red 
     39    keyword whole char red 
     40    keyword whole class red 
     41    keyword whole const red 
     42    keyword whole default red 
     43    keyword whole double red 
     44    keyword whole enum red 
     45    keyword whole extern red 
     46    keyword whole false red 
     47    keyword whole friend red 
     48    keyword whole inline red 
     49    keyword whole long red 
     50    keyword whole private red 
     51    keyword whole protected red 
     52    keyword whole short red 
     53    keyword whole signed red 
     54    keyword whole sizeof red 
     55    keyword whole static red 
     56    keyword whole struct red 
     57    keyword whole switch red 
     58    keyword whole template red 
     59    keyword whole this red 
     60    keyword whole true red 
     61    keyword whole typedef red 
     62    keyword whole uniform red 
     63    keyword whole union red 
     64    keyword whole unsigned red 
     65    keyword whole varying red 
     66    keyword whole virtual red 
     67 
     68# Shader types 
     69    keyword whole shader white 
     70    keyword whole surface white 
     71    keyword whole displacement white 
     72    keyword whole volume white 
     73 
     74    keyword /\* brown 
     75    keyword \*/ brown 
     76    keyword // brown 
     77 
     78    keyword '\\\{"abtnvfr\}' brightgreen 
     79    keyword '\\\{0123\}\{01234567\}\{01234567\}' brightgreen 
     80    keyword '\\'' brightgreen 
     81    keyword '\\\\' brightgreen 
     82    keyword '\\0' brightgreen 
     83    keyword '\{\s!"#$%&()\*\+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\}' brightgreen 
     84 
     85# punctuation characters, sorted by ASCII code 
     86    keyword ! yellow 
     87    keyword % yellow 
     88    keyword && yellow 
     89    keyword & brightmagenta 
     90    keyword ( brightcyan 
     91    keyword ) brightcyan 
     92    keyword \* yellow 
     93    keyword \+ yellow 
     94    keyword , brightcyan 
     95    keyword - yellow 
     96    keyword / yellow 
     97    keyword : brightcyan 
     98    keyword ; brightmagenta 
     99    keyword < yellow 
     100    keyword = yellow 
     101    keyword > yellow 
     102    keyword ? brightcyan 
     103    keyword [ brightcyan 
     104    keyword ] brightcyan 
     105    keyword ^ brightmagenta 
     106    keyword { brightcyan 
     107    keyword || yellow 
     108    keyword | brightmagenta 
     109    keyword } brightcyan 
     110    keyword ~ brightmagenta 
     111 
     112context exclusive /\* \*/ brown 
     113    spellcheck 
     114 
     115context exclusive // \n brown 
     116    spellcheck 
     117 
     118context linestart # \n brightred 
     119    keyword \\\n yellow 
     120    keyword /\**\*/ brown 
     121    keyword //*\n brown 
     122    keyword "+" red 
     123    keyword <+> red 
     124 
     125context " " green 
     126    spellcheck 
     127    keyword \\" brightgreen 
     128    keyword %% brightgreen 
     129    keyword %\[#0\s-\+,\]\[0123456789\*\]\[.\]\[0123456789\*\]\[L\]\{eEfgGoxX\} brightgreen 
     130    keyword %\[0\s-\+,\]\[0123456789\*\]\[.\]\[0123456789\*\]\[hl\]\{diuxX\} brightgreen 
     131    keyword %\[hl\]n brightgreen 
     132    keyword %\[-\]\[0123456789\*\]\[.\]\[0123456789\*\]s brightgreen 
     133    keyword %[*] brightgreen 
     134    keyword %c brightgreen 
     135    keyword %p brightgreen 
     136    keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen 
     137    keyword \\\\ brightgreen 
     138    keyword \\' brightgreen 
     139    keyword \\\{abtnvfr\} brightgreen