-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStrictDoc.sublime-syntax
182 lines (181 loc) · 4.75 KB
/
StrictDoc.sublime-syntax
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
name: StrictDoc
comment: 'StrictDoc Syntax: version 1.0'
file_extensions:
- sdoc
first_line_match: '^\[DOCUMENT\]$'
scope: source.sdoc
contexts:
main:
- include: document
- include: grammar
- include: section
- include: requirement
- include: freetext
- include: keywords
choice_boolean:
- match: \b(True|False)\b
scope: constant.language
choice_enable:
- match: \b(On|Off)\b
scope: constant.language
document:
- match: '(?<!\.)^\[DOCUMENT\]$'
captures:
0: keyword
push:
- meta_scope: ''
- match: ^$
pop: true
- include: document_field_name
- include: document_options
document_field_name:
- match: '^\b(TITLE|UID|VERSION|CLASSIFICATION)\b:'
scope: keyword.control
document_options:
- match: ^OPTIONS:$
captures:
0: keyword.control
push:
- meta_scope: ''
- match: ^$
pop: true
- include: document_options_markup
- include: document_options_auto_levels
- include: document_options_requirement_style
- include: document_options_requirement_in_toc
document_options_auto_levels:
- match: (^\s\sAUTO_LEVELS:)
captures:
0: keyword.control
push:
- meta_scope: constant.numeric
- match: $
pop: true
- include: choice_enable
document_options_markup:
- match: (^\s\sMARKUP:)\s\b(RST|Text|HTML)\b$
scope: constant.numeric
captures:
1: keyword.control
2: constant.character
document_options_requirement_in_toc:
- match: (^\s\sREQUIREMENT_IN_TOC:)
captures:
0: keyword.control
push:
- meta_scope: constant.numeric
- match: $
pop: true
- include: choice_boolean
document_options_requirement_style:
- match: (^\s\sREQUIREMENT_STYLE:)\s\b(Inline|Simple|Table|Zebra)\b$
scope: constant.numeric
captures:
1: keyword.control
2: constant.character
freetext:
- match: '^\[FREETEXT\]$'
captures:
0: keyword
embed: scope:text.restructuredtext
escape: '^\[\/FREETEXT\]$'
escape_captures:
0: keyword
grammar:
- match: '^\[\b(GRAMMAR)\b\]$'
captures:
0: keyword
push:
- meta_scope: emphasis
- match: ^$
pop: true
- match: '^ELEMENTS:'
scope: keyword
- match: '^(-|\s)\s(TAG|FIELDS):'
scope: keyword
- include: grammar_field_title
- include: grammar_field_type
- include: grammar_field_required
grammar_field_reference_choice:
- match: \b(ParentReqReference|FileReference|BibReference)\b
scope: constant.character
grammar_field_required:
- match: (^\s\s\s\sREQUIRED:)\s
captures:
0: keyword
push:
- meta_scope: ''
- match: $
pop: true
- include: choice_boolean
grammar_field_title:
- match: (^\s\s-\sTITLE:)\s
captures:
0: keyword
push:
- meta_scope: ''
- match: $
pop: true
- match: \b(UID|REFS|TITLE|STATEMENT|RATIONALE|COMMENT)\b
scope: keyword.control
grammar_field_type:
- match: (^\s\s\s\sTYPE:)\s
captures:
0: keyword
push:
- meta_scope: ''
- match: $
pop: true
- match: \b(String|Tag|SingleChoice\(|MultipleChoice\(|Reference\()\b
scope: constant.numeric
- include: grammar_field_reference_choice
keywords:
- match: '\[\/(REQUIREMENT|GRAMMAR|DOCUMENT)\]'
scope: invalid.illegal
- match: '^\[\/?SECTION\]$'
scope: keyword
requirement:
- match: '^\[REQUIREMENT\]$'
captures:
0: keyword
push:
- match: ^$
captures:
0: keyword
pop: true
- include: rst_field_value
- include: requirement_fields
- include: requirement_field_params
requirement_field_params:
- match: ^(-\sTYPE|\s\sVALUE):\s
scope: keyword.other
requirement_fields:
- match: ^(UID|REFS|TITLE|STATEMENT|RATIONALE|COMMENT):\s
scope: keyword.control
rst:
- match: (.*)
comment: 'custom bundle name for reStructuredText: text.restructuredtext.'
captures:
0: text.restructuredtext
rst_field_value:
- match: '>>>$'
captures:
0: string.quoted.double
embed: scope:text.restructuredtext
escape: '^<<<$'
escape_captures:
0: string.quoted.double
section:
- match: '^\[SECTION\]$'
captures:
0: keyword
push:
- match: ^$
captures:
0: keyword
pop: true
- match: ^(UID|TITLE):\s
scope: keyword.control