aboutsummaryrefslogtreecommitdiff
path: root/resources/wmap.lang
blob: e05c8d3d2bde4e2b474747fbd91229c77b8ba956 (plain)
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
<?xml version="1.0" encoding="UTF-8"?>
<language id="wmap" name="wmap Wardley Map Definition Language" version="2.0" section="Markup">
  <metadata>
    <property name="mimetypes">text/x-wmap</property>
    <property name="globs">*.wmap</property>
    <property name="line-comment-start">#</property>
  </metadata>

  <styles>
    <style id="keyword" name="Keyword" map-to="def:keyword"/>
    <style id="node-name" name="Node Name" map-to="def:identifier"/>
    <style id="coordinate" name="Coordinate" map-to="def:number"/>
    <style id="shape" name="Shape" map-to="def:type"/>
    <style id="operator" name="Operator" map-to="def:operator"/>
    <style id="note-text" name="Note Text" map-to="def:string"/>
    <style id="evolution-sign" name="Evolution Sign" map-to="def:operator"/>
    <style id="stage" name="Stage" map-to="def:special-constant"/>
    <style id="group-list" name="Group List" map-to="def:identifier"/>
  </styles>

  <definitions>
    <!-- Node pattern: Name (x,y) [optional shape] -->
    <context id="node">
      <match extended="true" case-sensitive="false">
        ^([^\(\[\]]*?)\s*
        \(\s*([0-9]+\.?[0-9]*)\s*,\s*([0-9]+\.?[0-9]*)\s*\)
        \s*(?:\[(Square|Triangle|x)\])?\s*$
      </match>
      <include>
        <context sub-pattern="1" style-ref="node-name"/>
        <context sub-pattern="2" style-ref="coordinate"/>
        <context sub-pattern="3" style-ref="coordinate"/>
        <context sub-pattern="4" style-ref="shape"/>
      </include>
    </context>

    <!-- Edge pattern: Node -\- Node or Node -> Node -->
    <context id="edge">
      <match extended="true" case-sensitive="false">
        ^(.+?)\s*(--|-&gt;)\s*(.+)$
      </match>
      <include>
        <context sub-pattern="1" style-ref="node-name"/>
        <context sub-pattern="2" style-ref="operator"/>
        <context sub-pattern="3" style-ref="node-name"/>
      </include>
    </context>

    <!-- Inertia pattern: [Inertia] Node -->
    <context id="inertia">
      <match extended="true" case-sensitive="false">
        ^\[(inertia)\]\s*(.+)$
      </match>
      <include>
        <context sub-pattern="1" style-ref="keyword"/>
        <context sub-pattern="2" style-ref="node-name"/>
      </include>
    </context>

    <!-- Evolution pattern: [Evolution] Node +/-x -->
    <context id="evolution">
      <match extended="true" case-sensitive="false">
        ^\[(Evolution)\]\s*(.+)\s*([-+])\s*([0-9]+\.?[0-9]*)$
      </match>
      <include>
        <context sub-pattern="1" style-ref="keyword"/>
        <context sub-pattern="2" style-ref="node-name"/>
        <context sub-pattern="3" style-ref="evolution-sign"/>
        <context sub-pattern="4" style-ref="coordinate"/>
      </include>
    </context>

    <!-- Note pattern: [Note] (x,y) Text -->
    <context id="note">
      <match extended="true" case-sensitive="false">
        ^\[(Note)\]\s*
        \(\s*([0-9]+\.?[0-9]*)\s*,\s*([0-9]+\.?[0-9]*)\s*\)
        \s*(.*)$
      </match>
      <include>
        <context sub-pattern="1" style-ref="keyword"/>
        <context sub-pattern="2" style-ref="coordinate"/>
        <context sub-pattern="3" style-ref="coordinate"/>
        <context sub-pattern="4" style-ref="note-text"/>
      </include>
    </context>

    <!-- Stage pattern: [I], [II], or [III] x -->
    <context id="stage">
      <match extended="true" case-sensitive="false">
        ^\[(I{1,3})\]\s*([0-9]+\.?[0-9]*)$
      </match>
      <include>
        <context sub-pattern="1" style-ref="stage"/>
        <context sub-pattern="2" style-ref="coordinate"/>
      </include>
    </context>

    <!-- Group pattern: [Group] Node1, Node2, ... -->
    <context id="group">
      <match extended="true" case-sensitive="false">
        ^\[(Group)\]\s*(.+)$
      </match>
      <include>
        <context sub-pattern="1" style-ref="keyword"/>
        <context sub-pattern="2" style-ref="group-list"/>
      </include>
    </context>

    <!-- Main context -->
    <context id="wmap">
      <include>
        <context ref="inertia"/>
        <context ref="evolution"/>
        <context ref="note"/>
        <context ref="stage"/>
        <context ref="group"/>
        <context ref="edge"/>
        <context ref="node"/>
      </include>
    </context>
  </definitions>
</language>