source: node_modules/refractor/lang/squirrel.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1'use strict'
2
3module.exports = squirrel
4squirrel.displayName = 'squirrel'
5squirrel.aliases = []
6function squirrel(Prism) {
7 Prism.languages.squirrel = Prism.languages.extend('clike', {
8 comment: [
9 Prism.languages.clike['comment'][0],
10 {
11 pattern: /(^|[^\\:])(?:\/\/|#).*/,
12 lookbehind: true,
13 greedy: true
14 }
15 ],
16 string: {
17 pattern: /(^|[^\\"'@])(?:@"(?:[^"]|"")*"(?!")|"(?:[^\\\r\n"]|\\.)*")/,
18 lookbehind: true,
19 greedy: true
20 },
21 'class-name': {
22 pattern: /(\b(?:class|enum|extends|instanceof)\s+)\w+(?:\.\w+)*/,
23 lookbehind: true,
24 inside: {
25 punctuation: /\./
26 }
27 },
28 keyword:
29 /\b(?:__FILE__|__LINE__|base|break|case|catch|class|clone|const|constructor|continue|default|delete|else|enum|extends|for|foreach|function|if|in|instanceof|local|null|resume|return|static|switch|this|throw|try|typeof|while|yield)\b/,
30 number: /\b(?:0x[0-9a-fA-F]+|\d+(?:\.(?:\d+|[eE][+-]?\d+))?)\b/,
31 operator: /\+\+|--|<=>|<[-<]|>>>?|&&?|\|\|?|[-+*/%!=<>]=?|[~^]|::?/,
32 punctuation: /[(){}\[\],;.]/
33 })
34 Prism.languages.insertBefore('squirrel', 'string', {
35 char: {
36 pattern: /(^|[^\\"'])'(?:[^\\']|\\(?:[xuU][0-9a-fA-F]{0,8}|[\s\S]))'/,
37 lookbehind: true,
38 greedy: true
39 }
40 })
41 Prism.languages.insertBefore('squirrel', 'operator', {
42 'attribute-punctuation': {
43 pattern: /<\/|\/>/,
44 alias: 'important'
45 },
46 lambda: {
47 pattern: /@(?=\()/,
48 alias: 'operator'
49 }
50 })
51}
Note: See TracBrowser for help on using the repository browser.