main
Last change
on this file since e48199a was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 | var refractorC = require('./c.js')
|
---|
| 3 | module.exports = bison
|
---|
| 4 | bison.displayName = 'bison'
|
---|
| 5 | bison.aliases = []
|
---|
| 6 | function bison(Prism) {
|
---|
| 7 | Prism.register(refractorC)
|
---|
| 8 | Prism.languages.bison = Prism.languages.extend('c', {})
|
---|
| 9 | Prism.languages.insertBefore('bison', 'comment', {
|
---|
| 10 | bison: {
|
---|
| 11 | // This should match all the beginning of the file
|
---|
| 12 | // including the prologue(s), the bison declarations and
|
---|
| 13 | // the grammar rules.
|
---|
| 14 | pattern: /^(?:[^%]|%(?!%))*%%[\s\S]*?%%/,
|
---|
| 15 | inside: {
|
---|
| 16 | c: {
|
---|
| 17 | // Allow for one level of nested braces
|
---|
| 18 | pattern: /%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/,
|
---|
| 19 | inside: {
|
---|
| 20 | delimiter: {
|
---|
| 21 | pattern: /^%?\{|%?\}$/,
|
---|
| 22 | alias: 'punctuation'
|
---|
| 23 | },
|
---|
| 24 | 'bison-variable': {
|
---|
| 25 | pattern: /[$@](?:<[^\s>]+>)?[\w$]+/,
|
---|
| 26 | alias: 'variable',
|
---|
| 27 | inside: {
|
---|
| 28 | punctuation: /<|>/
|
---|
| 29 | }
|
---|
| 30 | },
|
---|
| 31 | rest: Prism.languages.c
|
---|
| 32 | }
|
---|
| 33 | },
|
---|
| 34 | comment: Prism.languages.c.comment,
|
---|
| 35 | string: Prism.languages.c.string,
|
---|
| 36 | property: /\S+(?=:)/,
|
---|
| 37 | keyword: /%\w+/,
|
---|
| 38 | number: {
|
---|
| 39 | pattern: /(^|[^@])\b(?:0x[\da-f]+|\d+)/i,
|
---|
| 40 | lookbehind: true
|
---|
| 41 | },
|
---|
| 42 | punctuation: /%[%?]|[|:;\[\]<>]/
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
| 45 | })
|
---|
| 46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.