Ticket #4470: Ticket-4470-add-mcedit-B-language-syntax-highlight.patch

File Ticket-4470-add-mcedit-B-language-syntax-highlight.patch, 9.1 KB (added by GyorgyRotter, 12 months ago)

patch file for B language syntax by Gyorgy Rotter

  • misc/syntax/Makefile.am

    From 6fbaf373f2379860b96cf99ee93a860a2cf41b27 Mon Sep 17 00:00:00 2001
    From: Gyorgy Rotter <gyurirotter@protonmail.com>
    Date: Tue, 30 May 2023 09:20:51 +0200
    Subject: [PATCH] Ticket #4470: add (mcedit) B language syntax highlight
    
    ---
     misc/syntax/Makefile.am |   1 +
     misc/syntax/Syntax.in   |   3 +
     misc/syntax/b.syntax    | 382 ++++++++++++++++++++++++++++++++++++++++
     3 files changed, 386 insertions(+)
     create mode 100644 misc/syntax/b.syntax
    
    diff --git a/misc/syntax/Makefile.am b/misc/syntax/Makefile.am
    index 59944564d..a6f12d9d8 100644
    a b SYNTAXFILES = \ 
    99        aspx.syntax             \ 
    1010        assembler.syntax        \ 
    1111        awk.syntax              \ 
     12        b.syntax                \ 
    1213        c.syntax                \ 
    1314        cabal.syntax            \ 
    1415        changelog.syntax        \ 
  • misc/syntax/Syntax.in

    diff --git a/misc/syntax/Syntax.in b/misc/syntax/Syntax.in
    index 95bf6bdad..f45ef9432 100644
    a b include privoxy.syntax 
    345345file .\*\\.toml$ TOML\sFile 
    346346include toml.syntax 
    347347 
     348file .\*\\.(mch|ref|imp)$ B\sFile 
     349include b.syntax 
     350 
    348351file .\* unknown 
    349352include unknown.syntax 
  • new file misc/syntax/b.syntax

    diff --git a/misc/syntax/b.syntax b/misc/syntax/b.syntax
    new file mode 100644
    index 000000000..7cd91a0a8
    - +  
     1# B language keywords 
     2# by Gyorgy Rotter 
     3# 
     4# For the proper syntax highlight the order of the keywords are 
     5# important. This is why the related keywords are not listed in a block. 
     6# To create semantic relationship between the keywords I used groups. 
     7# Some keywords are in a group (the name of the group is 
     8# indicated in a commented line above the keyword definition) 
     9# 
     10# With the one-liner for example we could replace 
     11# the color of the keywords which are the members of the 
     12# "Sequences" group from "yellow" to "red"... 
     13# 
     14#  echo Sequences yellow red | xargs -l bash -c 'sed -z "s/\(# $0\n[^\n]*\)$1/\1$2/g" b.syntax' 
     15#         ^         ^     ^ 
     16#         |         |     | 
     17#         |         |     -- new_color 
     18#         |         -- actual_color 
     19#         -- groupname 
     20# 
     21# 
     22# Usable groups: 
     23#   Relations, Sequences, Logical, Arithmetic, Sets, Substitutions 
     24# 
     25# Usable colors: 
     26#   described in the Syntax file 
     27# 
     28 
     29context default 
     30    keyword whole ABSTRACT_CONSTANTS yellow 
     31    keyword whole ABSTRACT_VARIABLES yellow 
     32    keyword whole CONCRETE_CONSTANTS yellow 
     33    keyword whole CONCRETE_VARIABLES yellow 
     34    keyword whole LOCAL_OPERATIONS yellow 
     35    keyword whole IMPLEMENTATION yellow 
     36    keyword whole INITIALISATION yellow 
     37    keyword whole CONSTRAINTS yellow 
     38    keyword whole DEFINITIONS yellow 
     39    keyword whole ASSERTIONS yellow 
     40    keyword whole OPERATIONS yellow 
     41    keyword whole PROPERTIES yellow 
     42    keyword whole REFINEMENT yellow 
     43    keyword whole CONSTANTS yellow 
     44    keyword whole INVARIANT yellow 
     45    keyword whole sequences yellow 
     46    keyword whole VARIABLES yellow 
     47    keyword whole Cardinal yellow 
     48 
     49    # Relations 
     50    keyword whole closure1 white 
     51 
     52    keyword whole INCLUDES yellow 
     53 
     54    # Arithmetic 
     55    keyword whole NATURAL1 yellow 
     56 
     57    keyword whole PROMOTES yellow 
     58    keyword whole Boolean yellow 
     59    keyword whole EXTENDS yellow 
     60    keyword whole IMPORTS yellow 
     61 
     62    # Arithmetic 
     63    keyword whole INTEGER yellow 
     64 
     65    keyword whole iterate yellow 
     66    keyword whole MACHINE yellow 
     67 
     68    # Arithmetic 
     69    keyword whole NATURAL yellow 
     70 
     71    keyword whole postfix yellow 
     72    keyword whole REFINES yellow 
     73    keyword whole subtree yellow 
     74    keyword whole VARIANT yellow 
     75    keyword whole ASSERT yellow 
     76    keyword whole CHOICE yellow 
     77 
     78    # Relations 
     79    keyword whole closure white 
     80 
     81    keyword whole EITHER yellow 
     82    keyword whole father yellow 
     83    keyword whole MAXINT yellow 
     84    keyword whole MININT yellow 
     85    keyword whole mirror yellow 
     86    keyword whole modulo yellow 
     87    keyword whole prefix yellow 
     88    keyword whole SELECT yellow 
     89    keyword whole STRING yellow 
     90    keyword whole struct yellow 
     91    keyword whole VALUES yellow 
     92    keyword whole arity yellow 
     93    keyword whole BEGIN yellow 
     94    keyword whole btree yellow 
     95    keyword whole const yellow 
     96    keyword whole ELSIF yellow 
     97    keyword whole FALSE yellow 
     98    keyword whole first yellow 
     99    keyword whole front yellow 
     100    keyword whole infix yellow 
     101 
     102    # Sets 
     103    keyword whole INTER yellow 
     104 
     105    keyword whole inter yellow 
     106    keyword whole iseq1 yellow 
     107    keyword whole right yellow 
     108 
     109    # Arithmetic 
     110    keyword whole SIGMA yellow 
     111 
     112    keyword whole sizet yellow 
     113 
     114    # Sets 
     115    keyword whole UNION yellow 
     116 
     117    keyword whole union yellow 
     118    keyword whole WHERE yellow 
     119    keyword whole WHILE yellow 
     120    keyword whole bool yellow 
     121    keyword whole BOOL yellow 
     122    keyword whole card yellow 
     123    keyword whole CASE yellow 
     124    keyword whole conc yellow 
     125    keyword whole ELSE yellow 
     126 
     127    # Sets 
     128    keyword whole FIN1 yellow 
     129 
     130    keyword whole iseq yellow 
     131    keyword whole last yellow 
     132    keyword whole left yellow 
     133    keyword whole NAT1 yellow 
     134 
     135    # Sets 
     136    keyword whole POW1 yellow 
     137 
     138    keyword whole perm yellow 
     139    keyword whole pred yellow 
     140    keyword whole prj1 yellow 
     141    keyword whole prj2 yellow 
     142    keyword whole rank yellow 
     143    keyword whole SEES yellow 
     144    keyword whole seq1 yellow 
     145    keyword whole SETS yellow 
     146    keyword whole size yellow 
     147    keyword whole skip yellow 
     148    keyword whole sons yellow 
     149    keyword whole succ yellow 
     150    keyword whole tail yellow 
     151    keyword whole THEN yellow 
     152    keyword whole tree yellow 
     153    keyword whole TRUE yellow 
     154    keyword whole USES yellow 
     155    keyword whole WHEN yellow 
     156    keyword whole ANY yellow 
     157    keyword whole bin yellow 
     158    keyword whole dom yellow 
     159    keyword whole END yellow 
     160 
     161    # Sets 
     162    keyword whole FIN yellow 
     163 
     164    keyword whole fnc yellow 
     165    keyword whole INT yellow 
     166    keyword whole LET yellow 
     167    keyword whole max yellow 
     168    keyword whole min yellow 
     169    keyword whole mod yellow 
     170    keyword whole NAT yellow 
     171 
     172    # Logical 
     173    keyword whole not cyan 
     174 
     175    # Sets 
     176    keyword whole POW yellow 
     177 
     178    keyword whole PRE yellow 
     179    keyword whole ran yellow 
     180    keyword whole rec yellow 
     181    keyword whole rel yellow 
     182    keyword whole rev yellow 
     183    keyword whole seq yellow 
     184    keyword whole Set yellow 
     185    keyword whole son yellow 
     186    keyword whole top yellow 
     187    keyword whole VAR yellow 
     188    keyword whole BE yellow 
     189    keyword whole DO yellow 
     190    keyword whole id yellow 
     191    keyword whole IF yellow 
     192    keyword whole IN yellow 
     193    keyword whole OF yellow 
     194    keyword whole OR yellow 
     195 
     196    # Logical 
     197    keyword whole or cyan 
     198 
     199    # Arithmetic 
     200    keyword whole PI yellow 
     201 
     202# prevents - keyword from interfering with comment 
     203    keyword /\* green 
     204    keyword \*/ green 
     205    keyword // green 
     206 
     207 
     208    keyword <-- yellow 
     209    keyword := yellow 
     210 
     211 
     212    # Relations 
     213    keyword \+->> white 
     214 
     215    # Relations 
     216    keyword -->> white 
     217 
     218    # Sets 
     219    keyword /<<: yellow 
     220 
     221    # Sequences 
     222    keyword /|\\ magenta 
     223 
     224    # Relations 
     225    keyword >->> white 
     226 
     227    # Relations 
     228    keyword >\+> white 
     229 
     230    # Arithmetic 
     231    keyword \*\* yellow 
     232 
     233    # Relations 
     234    keyword \+-> white 
     235 
     236    # Sequences 
     237    keyword \\|/ magenta 
     238 
     239    # Relations 
     240    keyword --> white 
     241 
     242    # Sets 
     243    keyword /<: yellow 
     244 
     245    # Sets 
     246    keyword /\\ yellow 
     247 
     248    # Relations 
     249    keyword <-> white 
     250 
     251    # Sets 
     252    keyword <<: yellow 
     253 
     254    # Relations 
     255    keyword <<| white 
     256 
     257    # Logical 
     258    keyword <=> cyan 
     259 
     260    # Relations 
     261    keyword <\+ white 
     262 
     263    # Relations 
     264    keyword >-> white 
     265 
     266    # Sets 
     267    keyword \\/ yellow 
     268 
     269    # Relations 
     270    keyword |-> white 
     271 
     272    # Relations 
     273    keyword |>> white 
     274 
     275    keyword != yellow 
     276 
     277    # Sequences 
     278    keyword -> magenta 
     279 
     280    # Sets 
     281    keyword /: yellow 
     282 
     283    # Logical 
     284    keyword /= cyan 
     285 
     286    # Substitutions 
     287    keyword :: yellow 
     288 
     289    # Sequences 
     290    keyword <- magenta 
     291 
     292    # Sets 
     293    keyword <: yellow 
     294 
     295    # Arithmetic 
     296    keyword <= yellow 
     297 
     298    # Relations 
     299    keyword <| white 
     300 
     301    keyword == yellow 
     302 
     303    # Logical 
     304    keyword => cyan 
     305 
     306    # Relations 
     307    keyword >< white 
     308 
     309    # Arithmetic 
     310    keyword >= yellow 
     311 
     312    # Arithmetic 
     313    keyword \* yellow 
     314 
     315    # Arithmetic 
     316    keyword \+ yellow 
     317 
     318    # Sets 
     319    keyword {} yellow 
     320 
     321    # Relations 
     322    keyword |> white 
     323 
     324    # Logical 
     325    keyword ! cyan 
     326 
     327    # Logical 
     328    keyword # cyan 
     329 
     330    # Relations 
     331    keyword % white 
     332 
     333    # Logical 
     334    keyword & cyan 
     335 
     336    keyword ( yellow 
     337    keyword ) yellow 
     338    keyword , yellow 
     339 
     340    # Arithmetic 
     341    keyword - yellow 
     342 
     343    # Arithmetic 
     344    keyword / yellow 
     345 
     346    # Sets 
     347    keyword : yellow 
     348 
     349    keyword ; yellow 
     350 
     351    # Arithmetic 
     352    keyword < yellow 
     353 
     354    # Logical 
     355    keyword = cyan 
     356 
     357    # Arithmetic 
     358    keyword > yellow 
     359 
     360    keyword ? yellow 
     361    keyword [ yellow 
     362    keyword ] yellow 
     363 
     364    # Sequences 
     365    keyword ^ magenta 
     366 
     367    keyword { yellow 
     368    keyword } yellow 
     369 
     370    keyword | yellow 
     371 
     372    # Relations 
     373    keyword ~ white 
     374 
     375 
     376context exclusive /\* \*/ green 
     377    spellcheck 
     378 
     379context exclusive // \n green 
     380    spellcheck 
     381 
     382context " "    brightgreen