source: node_modules/refractor/lang/go.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.3 KB
RevLine 
[d24f17c]1'use strict'
2
3module.exports = go
4go.displayName = 'go'
5go.aliases = []
6function go(Prism) {
7 Prism.languages.go = Prism.languages.extend('clike', {
8 string: {
9 pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
10 lookbehind: true,
11 greedy: true
12 },
13 keyword:
14 /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
15 boolean: /\b(?:_|false|iota|nil|true)\b/,
16 number: [
17 // binary and octal integers
18 /\b0(?:b[01_]+|o[0-7_]+)i?\b/i, // hexadecimal integers and floats
19 /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i, // decimal integers and floats
20 /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
21 ],
22 operator:
23 /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
24 builtin:
25 /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
26 })
27 Prism.languages.insertBefore('go', 'string', {
28 char: {
29 pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
30 greedy: true
31 }
32 })
33 delete Prism.languages.go['class-name']
34}
Note: See TracBrowser for help on using the repository browser.