go.js (1723B)
1 /* 2 Language: Go 3 Author: Stephan Kountso aka StepLg <steplg@gmail.com> 4 Contributors: Evgeny Stepanischev <imbolk@gmail.com> 5 Description: Google go language (golang). For info about language 6 Website: http://golang.org/ 7 Category: common, system 8 */ 9 10 function go(hljs) { 11 var 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 {begin: '`', end: '`'}, 36 ] 37 }, 38 { 39 className: 'number', 40 variants: [ 41 {begin: hljs.C_NUMBER_RE + '[i]', relevance: 1}, 42 hljs.C_NUMBER_MODE 43 ] 44 }, 45 { 46 begin: /:=/ // relevance booster 47 }, 48 { 49 className: 'function', 50 beginKeywords: 'func', end: '\\s*(\\{|$)', excludeEnd: true, 51 contains: [ 52 hljs.TITLE_MODE, 53 { 54 className: 'params', 55 begin: /\(/, end: /\)/, 56 keywords: GO_KEYWORDS, 57 illegal: /["']/ 58 } 59 ] 60 } 61 ] 62 }; 63 } 64 65 module.exports = go;