package tm-grammars

  1. Overview
  2. Docs
TextMate grammars as OCaml strings

Install

dune-project
 Dependency

Authors

Maintainers

Sources

tm-grammars-1.1.0.tbz
sha256=d06cd72e17331a9601c0b3a90a78b8f1be8f09b253a174aa5e52a624584af6bc
sha512=0fa76518e9018a9475ac84cfad140a6fcd42862669a3bb80d4b262f667b828285b967e09e35a14eaf7713cc099d5b0f30638b815c611a1bb41b94b35e33858e7

doc/src/tm-grammars.tex/tm_grammar_tex.ml.html

Source file tm_grammar_tex.ml

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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
let lang_id = "tex"
let json = {json|{
  "displayName": "TeX",
  "name": "tex",
  "patterns": [
    {
      "include": "#iffalse-block"
    },
    {
      "include": "#macro-control"
    },
    {
      "include": "#catcode"
    },
    {
      "include": "#comment"
    },
    {
      "match": "[]\\[]",
      "name": "punctuation.definition.brackets.tex"
    },
    {
      "include": "#dollar-math"
    },
    {
      "match": "\\\\\\\\",
      "name": "keyword.control.newline.tex"
    },
    {
      "include": "#ifnextchar"
    },
    {
      "include": "#macro-general"
    }
  ],
  "repository": {
    "braces": {
      "begin": "(?<!\\\\)\\{",
      "beginCaptures": {
        "0": {
          "name": "punctuation.group.begin.tex"
        }
      },
      "end": "(?<!\\\\)}",
      "endCaptures": {
        "0": {
          "name": "punctuation.group.end.tex"
        }
      },
      "name": "meta.group.braces.tex",
      "patterns": [
        {
          "include": "#braces"
        }
      ]
    },
    "catcode": {
      "captures": {
        "1": {
          "name": "keyword.control.catcode.tex"
        },
        "2": {
          "name": "punctuation.definition.keyword.tex"
        },
        "3": {
          "name": "punctuation.separator.key-value.tex"
        },
        "4": {
          "name": "constant.numeric.category.tex"
        }
      },
      "match": "((\\\\)catcode)`\\\\?.(=)(\\d+)",
      "name": "meta.catcode.tex"
    },
    "comment": {
      "begin": "(^[\\t ]+)?(?=%)",
      "beginCaptures": {
        "1": {
          "name": "punctuation.whitespace.comment.leading.tex"
        }
      },
      "end": "(?!\\G)",
      "patterns": [
        {
          "begin": "%:?",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.comment.tex"
            }
          },
          "end": "$\\n?",
          "name": "comment.line.percentage.tex"
        },
        {
          "begin": "^(%!TEX) (\\S*) =",
          "beginCaptures": {
            "1": {
              "name": "punctuation.definition.comment.tex"
            }
          },
          "end": "$\\n?",
          "name": "comment.line.percentage.directive.tex"
        }
      ]
    },
    "conditionals": {
      "begin": "(?<=^\\s*)\\\\if(?!f\\b)[a-z]*",
      "end": "(?<=^\\s*)\\\\fi",
      "patterns": [
        {
          "include": "#comment"
        },
        {
          "include": "#conditionals"
        }
      ]
    },
    "dollar-math": {
      "begin": "(\\$\\$?)",
      "beginCaptures": {
        "1": {
          "name": "punctuation.definition.string.begin.tex"
        }
      },
      "end": "(\\1)",
      "endCaptures": {
        "1": {
          "name": "punctuation.definition.string.end.tex"
        }
      },
      "name": "meta.math.block.tex support.class.math.block.tex",
      "patterns": [
        {
          "match": "\\\\\\$",
          "name": "constant.character.escape.tex"
        },
        {
          "include": "#math-content"
        },
        {
          "include": "$self"
        }
      ]
    },
    "iffalse-block": {
      "begin": "(?<=^\\s*)((\\\\)iffalse)(?!\\s*[{}]\\s*\\\\fi\\b)",
      "beginCaptures": {
        "1": {
          "name": "keyword.control.tex"
        },
        "2": {
          "name": "punctuation.definition.keyword.tex"
        }
      },
      "contentName": "comment.line.percentage.tex",
      "end": "((\\\\)(?:else|fi))\\b",
      "endCaptures": {
        "1": {
          "name": "keyword.control.tex"
        },
        "2": {
          "name": "punctuation.definition.keyword.tex"
        }
      },
      "patterns": [
        {
          "include": "#comment"
        },
        {
          "include": "#braces"
        },
        {
          "include": "#conditionals"
        }
      ]
    },
    "ifnextchar": {
      "match": "\\\\@ifnextchar[(\\[{]",
      "name": "keyword.control.ifnextchar.tex"
    },
    "macro-control": {
      "captures": {
        "1": {
          "name": "punctuation.definition.keyword.tex"
        }
      },
      "match": "(\\\\)(backmatter|csname|else|endcsname|fi|frontmatter|mainmatter|unless|if(case|cat|csname|defined|dim|eof|false|fontchar|hbox|hmode|inner|mmode|num|odd|true|vbox|vmode|void|x)?)(?![@-Za-z])",
      "name": "keyword.control.tex"
    },
    "macro-general": {
      "patterns": [
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.function.tex"
            }
          },
          "match": "(\\\\)_*[@\\p{Alphabetic}]+(?:_[@\\p{Alphabetic}]+)*:[DFNTVcefnopvwx]*",
          "name": "support.class.general.latex3.tex"
        },
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.function.tex"
            }
          },
          "match": "(\\.)[@\\p{Alphabetic}]+(?:_[@\\p{Alphabetic}]+)*:[DFNTVcefnopvwx]*",
          "name": "support.class.general.latex3.tex"
        },
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.function.tex"
            }
          },
          "match": "(\\\\)(?:[,;]|[@\\p{Alphabetic}]+)",
          "name": "support.function.general.tex"
        },
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.keyword.tex"
            }
          },
          "match": "(\\\\)[^@-Za-z]",
          "name": "constant.character.escape.tex"
        }
      ]
    },
    "math-content": {
      "patterns": [
        {
          "begin": "((\\\\)(?:text|mbox))(\\{)",
          "beginCaptures": {
            "1": {
              "name": "constant.other.math.tex"
            },
            "2": {
              "name": "punctuation.definition.function.tex"
            },
            "3": {
              "name": "punctuation.definition.arguments.begin.tex meta.text.normal.tex"
            }
          },
          "contentName": "meta.text.normal.tex",
          "end": "}",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.arguments.end.tex meta.text.normal.tex"
            }
          },
          "patterns": [
            {
              "include": "#math-content"
            },
            {
              "include": "$self"
            }
          ]
        },
        {
          "match": "\\\\[{}]",
          "name": "punctuation.math.bracket.pair.tex"
        },
        {
          "match": "\\\\(left|right|((bigg??|Bigg??)[lr]?))([]().<>\\[|]|\\\\[{|}]|\\\\[lr]?[Vv]ert|\\\\[lr]angle)",
          "name": "punctuation.math.bracket.pair.big.tex"
        },
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.constant.math.tex"
            }
          },
          "match": "(\\\\)(s(s(earrow|warrow|lash)|h(ort(downarrow|uparrow|parallel|leftarrow|rightarrow|mid)|arp)|tar|i(gma|m(eq)?)|u(cc(sim|n(sim|approx)|curlyeq|eq|approx)?|pset(neq(q)?|plus(eq)?|eq(q)?)?|rd|m|bset(neq(q)?|plus(eq)?|eq(q)?)?)|p(hericalangle|adesuit)|e(tminus|arrow)|q(su(pset(eq)?|bset(eq)?)|c([au]p)|uare)|warrow|m(ile|all(s(etminus|mile)|frown)))|h(slash|ook((?:lef|righ)tarrow)|eartsuit|bar)|R(sh|ightarrow|e|bag)|Gam(e|ma)|n(s(hort(parallel|mid)|im|u(cc(eq)?|pseteq(q)?|bseteq))|Rightarrow|n([ew]arrow)|cong|triangle(left(eq(slant)?)?|right(eq(slant)?)?)|i(plus)?|u|p(lus|arallel|rec(eq)?)|e(q|arrow|g|xists)|v([Dd]ash)|warrow|le(ss|q(slant|q)?|ft((?:|right)arrow))|a(tural|bla)|VDash|rightarrow|g(tr|eq(slant|q)?)|mid|Left((?:|right)arrow))|c(hi|irc(eq|le(d(circ|S|dash|ast)|arrow(left|right)))?|o(ng|prod|lon|mplement)|dot([ps])?|u(p|r(vearrow(left|right)|ly(eq(succ|prec)|vee((?:down|up)arrow)?|wedge((?:down|up)arrow)?)))|enterdot|lubsuit|ap)|Xi|Maps(to(char)?|from(char)?)|B(ox|umpeq|bbk)|t(h(ick(sim|approx)|e(ta|refore))|imes|op|wohead((?:lef|righ)tarrow)|a(u|lloblong)|riangle(down|q|left(eq(slant)?)?|right(eq(slant)?)?)?)|i(n(t(er(cal|leave))?|plus|fty)?|ota|math)|S(igma|u([bp]set))|zeta|o(slash|times|int|dot|plus|vee|wedge|lessthan|greaterthan|m(inus|ega)|b(slash|long|ar))|d(i(v(ideontimes)?|a(g(down|up)|mond(suit)?)|gamma)|o(t(plus|eq(dot)?)|ublebarwedge|wn(harpoon(left|right)|downarrows|arrow))|d(ots|agger)|elta|a(sh(v|leftarrow|rightarrow)|leth|gger))|Y(down|up|left|right)|C([au]p)|u(n([lr]hd)|p(silon|harpoon(left|right)|downarrow|uparrows|lus|arrow)|lcorner|rcorner)|jmath|Theta|Im|p(si|hi|i(tchfork)?|erp|ar(tial|allel)|r(ime|o(d|pto)|ec(sim|n(sim|approx)|curlyeq|eq|approx)?)|m)|e(t([ah])|psilon|q(slant(less|gtr)|circ|uiv)|ll|xists|mptyset)|Omega|D(iamond|ownarrow|elta)|v(d(ots|ash)|ee(bar)?|Dash|ar(s(igma|u(psetneq(q)?|bsetneq(q)?))|nothing|curly(vee|wedge)|t(heta|imes|riangle(left|right)?)|o(slash|circle|times|dot|plus|vee|wedge|lessthan|ast|greaterthan|minus|b(slash|ar))|p(hi|i|ropto)|epsilon|kappa|rho|bigcirc))|kappa|Up(silon|downarrow|arrow)|Join|f(orall|lat|a(t(s(emi|lash)|bslash)|llingdotseq)|rown)|P((?:s|h?)i)|w(p|edge|r)|l(hd|n(sim|eq(q)?|approx)|ceil|times|ightning|o(ng(left((?:|right)arrow)|rightarrow|maps(to|from))|zenge|oparrow(left|right))|dot([ps])|e(ss(sim|dot|eq(q?gtr)|approx|gtr)|q(slant|q)?|ft(slice|harpoon(down|up)|threetimes|leftarrows|arrow(t(ail|riangle))?|right(squigarrow|harpoons|arrow(s|triangle|eq)?))|adsto)|vertneqq|floor|l(c(orner|eil)|floor|l|bracket)?|a(ngle|mbda)|rcorner|bag)|a(s(ymp|t)|ngle|pprox(eq)?|l(pha|eph)|rrownot|malg)|V(v??dash)|r(h([do])|ceil|times|i(singdotseq|ght(s(quigarrow|lice)|harpoon(down|up)|threetimes|left(harpoons|arrows)|arrow(t(ail|riangle))?|rightarrows))|floor|angle|r(ceil|parenthesis|floor|bracket)|bag)|g(n(sim|eq(q)?|approx)|tr(sim|dot|eq(q?less)|less|approx)|imel|eq(slant|q)?|vertneqq|amma|g(g)?)|Finv|xi|m(ho|i(nuso|d)|o(o|dels)|u(ltimap)?|p|e(asuredangle|rge)|aps(to|from(char)?))|b(i(n(dnasrepma|ampersand)|g(s(tar|qc([au]p))|nplus|c(irc|u(p|rly(vee|wedge))|ap)|triangle(down|up)|interleave|o(times|dot|plus)|uplus|parallel|vee|wedge|box))|o(t|wtie|x(slash|circle|times|dot|plus|empty|ast|minus|b(slash|ox|ar)))|u(llet|mpeq)|e(cause|t(h|ween|a))|lack(square|triangle(down|left|right)?|lozenge)|a(ck(s(im(eq)?|lash)|prime|epsilon)|r(o|wedge))|bslash)|L(sh|ong(left((?:|right)arrow)|rightarrow|maps(to|from))|eft((?:|right)arrow)|leftarrow|ambda|bag)|ge|le|Arrownot)(?![@-Za-z])",
          "name": "constant.character.math.tex"
        },
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.constant.math.tex"
            }
          },
          "match": "(\\\\)(sum|prod|coprod|int|oint|bigcap|bigcup|bigsqcup|bigvee|bigwedge|bigodot|bigotimes|bogoplus|biguplus)\\b",
          "name": "constant.character.math.tex"
        },
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.constant.math.tex"
            }
          },
          "match": "(\\\\)(arccos|arcsin|arctan|arg|cosh??|coth??|csc|deg|det|dim|exp|gcd|hom|inf|ker|lg|lim|liminf|limsup|ln|log|max|min|pr|sec|sinh??|sup|tanh??)\\b",
          "name": "constant.other.math.tex"
        },
        {
          "begin": "((\\\\)Sexpr(\\{))",
          "beginCaptures": {
            "1": {
              "name": "support.function.sexpr.math.tex"
            },
            "2": {
              "name": "punctuation.definition.function.math.tex"
            },
            "3": {
              "name": "punctuation.section.embedded.begin.math.tex"
            }
          },
          "contentName": "support.function.sexpr.math.tex",
          "end": "(((})))",
          "endCaptures": {
            "1": {
              "name": "support.function.sexpr.math.tex"
            },
            "2": {
              "name": "punctuation.section.embedded.end.math.tex"
            },
            "3": {
              "name": "source.r"
            }
          },
          "name": "meta.embedded.line.r",
          "patterns": [
            {
              "begin": "\\G(?!})",
              "end": "(?=})",
              "name": "source.r",
              "patterns": [
                {
                  "include": "source.r"
                }
              ]
            }
          ]
        },
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.constant.math.tex"
            }
          },
          "match": "(\\\\)(?!begin\\{|verb)([A-Za-z]+)",
          "name": "constant.other.general.math.tex"
        },
        {
          "match": "(?<!\\\\)\\{",
          "name": "punctuation.math.begin.bracket.curly.tex"
        },
        {
          "match": "(?<!\\\\)}",
          "name": "punctuation.math.end.bracket.curly.tex"
        },
        {
          "match": "(?<!\\\\)\\(",
          "name": "punctuation.math.begin.bracket.round.tex"
        },
        {
          "match": "(?<!\\\\)\\)",
          "name": "punctuation.math.end.bracket.round.tex"
        },
        {
          "match": "(([0-9]*\\.[0-9]+)|[0-9]+)",
          "name": "constant.numeric.math.tex"
        },
        {
          "match": "[-*+/]|(?<!\\^)\\^(?!\\^)|(?<!_)_(?!_)",
          "name": "punctuation.math.operator.tex"
        }
      ]
    }
  },
  "scopeName": "text.tex"
}|json}