source: node_modules/highlight.js/lib/languages/go.js@ 65b6638

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

Initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2Language: Go
3Author: Stephan Kountso aka StepLg <steplg@gmail.com>
4Contributors: Evgeny Stepanischev <imbolk@gmail.com>
5Description: Google go language (golang). For info about language
6Website: http://golang.org/
7Category: common, system
8*/
9
10function go(hljs) {
11 const GO_KEYWORDS = {
12 keyword:
13 'break default func interface select case map struct chan else goto package switch ' +
14 'const fallthrough if range type continue for import return var go defer ' +
15 'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' +
16 'uint16 uint32 uint64 int uint uintptr rune',
17 literal:
18 'true false iota nil',
19 built_in:
20 'append cap close complex copy imag len make new panic print println real recover delete'
21 };
22 return {
23 name: 'Go',
24 aliases: ['golang'],
25 keywords: GO_KEYWORDS,
26 illegal: '</',
27 contains: [
28 hljs.C_LINE_COMMENT_MODE,
29 hljs.C_BLOCK_COMMENT_MODE,
30 {
31 className: 'string',
32 variants: [
33 hljs.QUOTE_STRING_MODE,
34 hljs.APOS_STRING_MODE,
35 {
36 begin: '`',
37 end: '`'
38 }
39 ]
40 },
41 {
42 className: 'number',
43 variants: [
44 {
45 begin: hljs.C_NUMBER_RE + '[i]',
46 relevance: 1
47 },
48 hljs.C_NUMBER_MODE
49 ]
50 },
51 {
52 begin: /:=/ // relevance booster
53 },
54 {
55 className: 'function',
56 beginKeywords: 'func',
57 end: '\\s*(\\{|$)',
58 excludeEnd: true,
59 contains: [
60 hljs.TITLE_MODE,
61 {
62 className: 'params',
63 begin: /\(/,
64 end: /\)/,
65 keywords: GO_KEYWORDS,
66 illegal: /["']/
67 }
68 ]
69 }
70 ]
71 };
72}
73
74module.exports = go;
Note: See TracBrowser for help on using the repository browser.