lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

plantuml.sublime-syntax (5445B)


      1 %YAML 1.2
      2 ---
      3 # See http://www.sublimetext.com/docs/3/syntax.html
      4 name: DiagramEx
      5 file_extensions:
      6   - wsd
      7   - uml
      8   - puml
      9   - plantuml
     10 scope: source.wsd
     11 
     12 variables:
     13   obj_name: '(?xi) [a-z_]  [a-z_0-9]*'
     14   color: '(?xi) \# (?: \d+ | {{obj_name}} )'
     15   known_color: |-
     16     (?xi) (?:
     17       AliceBlue | AntiqueWhite | Aqua | Aquamarine | Azure | Beige | Bisque | Black | BlanchedAlmond | Blue | BlueViolet |
     18       Brown | BurlyWood | CadetBlue | Chartreuse | Chocolate | Coral | CornflowerBlue | Cornsilk | Crimson | Cyan | DarkBlue |
     19       DarkCyan | DarkGoldenRod | DarkGray | DarkGreen | DarkGrey | DarkKhaki | DarkMagenta | DarkOliveGreen | DarkOrchid | DarkRed |
     20       DarkSalmon | DarkSeaGreen | DarkSlateBlue | DarkSlateGray | DarkSlateGrey | DarkTurquoise | DarkViolet | Darkorange | DeepPink |
     21       DeepSkyBlue | DimGray | DimGrey | DodgerBlue | FireBrick | FloralWhite | ForestGreen | Fuchsia | Gainsboro | GhostWhite | Gold |
     22       GoldenRod | Gray | Green | GreenYellow | Grey | HoneyDew | HotPink | IndianRed | Indigo | Ivory | Khaki | Lavender | LavenderBlush |
     23       LawnGreen | LemonChiffon | LightBlue | LightCoral | LightCyan | LightGoldenRodYellow | LightGray | LightGreen | LightGrey |
     24       LightPink | LightSalmon | LightSeaGreen | LightSkyBlue | LightSlateGray | LightSlateGrey | LightSteelBlue | LightYellow | Lime |
     25       LimeGreen | Linen | Magenta | Maroon | MediumAquaMarine | MediumBlue | MediumOrchid | MediumPurple | MediumSeaGreen |
     26       MediumSlateBlue | MediumSpringGreen | MediumTurquoise | MediumVioletRed | MidnightBlue | MintCream | MistyRose | Moccasin |
     27       NavajoWhite | Navy | OldLace | Olive | OliveDrab | Orange | OrangeRed | Orchid | PaleGoldenRod | PaleGreen | PaleTurquoise |
     28       PaleVioletRed | PapayaWhip | PeachPuff | Peru | Pink | Plum | PowderBlue | Purple | Red | RosyBrown | RoyalBlue | SaddleBrown |
     29       Salmon | SandyBrown | SeaGreen | SeaShell | Sienna | Silver | SkyBlue | SlateBlue | SlateGray | SlateGrey | Snow | SpringGreen |
     30       SteelBlue | Tan | Teal | Thistle | Tomato | Turquoise | Violet | Wheat | White | WhiteSmoke | Yellow | YellowGreen
     31     )
     32 
     33 
     34 contexts:
     35   main:
     36     - match: (?xi) ^ \s* ( \# | ' ) (?!.*')
     37       scope: comment.line.source.wsd
     38       push:
     39         - meta_scope: comment.line.source.wsd
     40         - match: \n
     41           pop: true
     42 
     43     - match: |-
     44         (?xi) ^ \s*
     45         \b (
     46           abstract | actor | artifact | class | component | database |
     47           enum | interface | object | package | participant | state |
     48           usecase
     49         ) \b
     50       scope: support.function.source.wsd
     51       push:
     52         - match: '(.*)(\{)'
     53           captures:
     54             1: entity.name.class.wsd entity.name.struct.wsd
     55           push:
     56             - meta_scope: meta.block.wsd
     57             - include: all_reamaining
     58             - match: '\}'
     59               pop: true
     60         - match: ''
     61           pop: true
     62 
     63     - include: all_reamaining
     64 
     65     # control keywords
     66     - match: |-
     67         (?xi) ^ \s* (
     68           @enduml | @startuml | activate | again | also | alt | as | autonumber | bottom | box | break |
     69           center | create | critical | deactivate | destroy | down | else | end | endif | endwhile | footbox |
     70           footer | fork | group | header | hide | if | is | left | link | loop | namespace |
     71           newpage | note | of | on | opt | over | page | par | partition | ref | repeat |
     72           return | right | rotate | show | skin | skinparam | start | stop | title | top to bottom direction | top |
     73           up | while
     74         )\b
     75       scope: keyword.control.source.wsd
     76 
     77     - match: (?xi) \b {{obj_name}} \b
     78       scope: variable.parameter.source.wsd
     79 
     80 
     81   all_reamaining:
     82     - match: (?xi) ^ \b title \b
     83       scope: string.quoted.double.source.wsd
     84       push:
     85         - match: '\n'
     86           scope: keyword.control.source.wsd
     87           pop: true
     88 
     89     # known colors
     90     - match: '{{known_color}}'
     91       scope: variable.source.wsd
     92 
     93     - match: |-
     94         (?xi) ^ \s* ( [\w\_\-]+ ) \s*
     95         (
     96           (?:["'].*?["'])? \s*
     97           (?:
     98               [\<\}\*o\.\+x\^\#\ ]             (?:[\-\-]|[\.\.]){2}?\*?
     99               | \*?(?:[\-\-]|[\.\.]){2}        [\{\>\*o\.\+x\^\#\ ]
    100 
    101               | [\<\{\*o\.\+x\^\#]\|?[-\.]?           ([^\|\-\s\.]*)[\-\.]
    102               | [\-\.]([^\|\-\s\.]*)                  [-\.]?\|?[\*o\.\+x\^\#\{\>]
    103           )
    104           \s* (?:["'].*?["'])? \s* ( [\w\_\-]+ )
    105         )
    106       captures:
    107         1: entity.name.function.wsd
    108         2: string.quoted.double.source.wsd
    109         3: keyword.control.source.wsd
    110         4: keyword.control.source.wsd
    111         5: entity.name.function.wsd
    112       push:
    113         - meta_scope: constant.string.source.wsd
    114         - match: ':'
    115           scope: keyword.control.source.wsd
    116         - match: \n
    117           pop: true
    118 
    119     - match: (?xi) ^ ( {{obj_name}} ) [ \t]* (:)
    120       captures:
    121         1: entity.name.function.wsd
    122         2: keyword.control.source.wsd
    123       push:
    124         - meta_scope: string.quoted.double.source.wsd
    125         - match: \n
    126           pop: true
    127 
    128     - match: \"
    129       scope: string.quoted.double.source.wsd
    130       push:
    131         - meta_scope: string.quoted.double.source.wsd
    132         - match: \"
    133           pop: true
    134 
    135     - match: \'
    136       scope: string.quoted.single.source.wsd
    137       push:
    138         - meta_scope: string.quoted.single.source.wsd
    139         - match: \'
    140           pop: true
    141 
    142     - match: (?xi) \b {{obj_name}} \b
    143       scope: constant.string.source.wsd