File: mscgen.lang

package info (click to toggle)
mscgen 0.20-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,120 kB
  • ctags: 1,016
  • sloc: ansic: 3,924; sh: 1,282; yacc: 320; lex: 234; makefile: 66
file content (136 lines) | stat: -rw-r--r-- 4,867 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?xml version="1.0" encoding="UTF-8"?>
<!--

   This is a language definition for gtksourceview describing
   the grammar of mscgen (which was written by Michael C McTernan).

   This file was originally written by: Niels Thykier <niels@thykier.net>

   This file is PUBLIC DOMAIN and may be freely reproduced,  distributed,
   transmitted, used, modified, built upon, or otherwise exploited by
   anyone for any purpose, commercial or non-commercial, and in any way,
   including by methods that have not yet been invented or conceived.

   This file is provided "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
   EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

-->
<language id="msc" _name="mscgen" version="2.0" _section="Others">
  <metadata>
    <property name="globs">*.msc</property>
  </metadata>
  <styles>
    <style id="attribute" _name="Arc attribute" map-to="def:keyword"/>
    <style id="arc" _name="Arc type" map-to="def:preprocessor"/>
    <style id="option" _name="Option or keyword" map-to="def:type"/>
    <!-- Default locale is US, hench _name="Color" -->
    <style id="colour" _name="Color" map-to="def:type"/>
  </styles>
  <!-- Attributes, options and colour names are case-insensitive -->
  <default-regex-options case-sensitive="false" />
  <definitions>

    <define-regex id="escaped-character" extended="true">
      \\                   # leading backslash
      [\\\"n]              # escaped character
    </define-regex>

    <context id="msc">
      <include>
        <context ref="def:shebang" />
        <context ref="c:comment" />
        <context ref="def:shell-like-comment" />
        <context ref="c:comment-multiline" />

        <!-- 
             Used for attribute/options values or entities that
             (might) contain spaces; named string in lack of a
             better name.
        -->
        <context id="string" end-at-line-end="false"
                 style-ref="def:string">
          <start>"</start>
          <end>"</end>
          <include>
            <context id="escaped-character"
                     style-ref="c:escaped-character">
              <match>\%{escaped-character}</match>
            </context>
          </include>
        </context>

        <!--
            Highlight colours as values (if they are not part of a
            quoted string).
        -->
        <context id="colour" style-ref="colour">
          <keyword>black</keyword>
          <keyword>blue</keyword>
          <keyword>green</keyword>
          <keyword>indigo</keyword>
          <keyword>violet</keyword>
          <keyword>orange</keyword>
          <keyword>red</keyword>
          <keyword>yellow</keyword>
          <keyword>white</keyword>
        </context>

        <context id="arc" style-ref="arc">
          <keyword>[ar]?box</keyword>
          <!-- Lost signal arcs (also case-insensitive) -->
          <keyword>-x</keyword>
          <keyword>x-</keyword>
          <!--
              all the other arcs - these fail to handle $entity $arc * and 
              * $arc $entity though plus I am not sure it helps
              having them coloured either way.
              
              Highlighting the "lost signal arc" makes sense because it
              could be confused with A [-][-] x (the arrowless version of
              -&gt;, the [] added to avoid breaking the comment).

          <keyword>&lt;&lt;=&gt;&gt;</keyword>
          <keyword>=&gt;&gt;</keyword>
          <keyword>&lt;&lt;=</keyword>
          <keyword>[-.=:]&gt;</keyword>
          <keyword>&lt;[-.=:]</keyword>

          <keywords>[-][-]</keyword>
          <keywords>==</keyword>
          <keywords>[.][.]</keyword>
          <keywords>::</keyword>
          -->
        </context>

        <context id="attribute" style-ref="attribute">
          <!-- Arc attribute names -->
          <keyword>label</keyword>
          <keyword>url</keyword>
          <keyword>id</keyword>
          <keyword>idurl</keyword>
          <keyword>linecolou?r</keyword>
          <keyword>textcolou?r</keyword>
          <keyword>textbgcolou?r</keyword>
          <keyword>arclinecolou?r</keyword>
          <keyword>arctextcolou?r</keyword>
          <keyword>arctextbgcolou?r</keyword>
          <keyword>arcskip</keyword>
        </context>

        <context id="option" style-ref="option">
          <!-- option names -->
          <keyword>hscale</keyword>
          <keyword>arcgradient</keyword>
          <keyword>width</keyword>
          <!-- 
               This is a keyword and not an option, but it seemed like
               overkill to make to create a context for a single
               context.
          -->
          <keyword>msc</keyword>
        </context>
      </include>
    </context>
  </definitions>
</language>