UNPKG

982 BJavaScriptView Raw
1Prism.languages.bison = Prism.languages.extend('c', {});
2
3Prism.languages.insertBefore('bison', 'comment', {
4 'bison': {
5 // This should match all the beginning of the file
6 // including the prologue(s), the bison declarations and
7 // the grammar rules.
8 pattern: /^(?:[^%]|%(?!%))*%%[\s\S]*?%%/,
9 inside: {
10 'c': {
11 // Allow for one level of nested braces
12 pattern: /%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/,
13 inside: {
14 'delimiter': {
15 pattern: /^%?\{|%?\}$/,
16 alias: 'punctuation'
17 },
18 'bison-variable': {
19 pattern: /[$@](?:<[^\s>]+>)?[\w$]+/,
20 alias: 'variable',
21 inside: {
22 'punctuation': /<|>/
23 }
24 },
25 rest: Prism.languages.c
26 }
27 },
28 'comment': Prism.languages.c.comment,
29 'string': Prism.languages.c.string,
30 'property': /\S+(?=:)/,
31 'keyword': /%\w+/,
32 'number': {
33 pattern: /(^|[^@])\b(?:0x[\da-f]+|\d+)/i,
34 lookbehind: true
35 },
36 'punctuation': /%[%?]|[|:;\[\]<>]/
37 }
38 }
39});