basant307/AI_Governance_Project
048
1/*2Language: Go3Author: Stephan Kountso aka StepLg <steplg@gmail.com>4Contributors: Evgeny Stepanischev <imbolk@gmail.com>5Description: Google go language (golang). For info about language6Website: http://golang.org/7Category: common, system8*/9 10function go(hljs) {11 const LITERALS = [12 "true",13 "false",14 "iota",15 "nil"16 ];17 const BUILT_INS = [18 "append",19 "cap",20 "close",21 "complex",22 "copy",23 "imag",24 "len",25 "make",26 "new",27 "panic",28 "print",29 "println",30 "real",31 "recover",32 "delete"33 ];34 const TYPES = [35 "bool",36 "byte",37 "complex64",38 "complex128",39 "error",40 "float32",41 "float64",42 "int8",43 "int16",44 "int32",45 "int64",46 "string",47 "uint8",48 "uint16",49 "uint32",50 "uint64",51 "int",52 "uint",53 "uintptr",54 "rune"55 ];56 const KWS = [57 "break",58 "case",59 "chan",60 "const",61 "continue",62 "default",63 "defer",64 "else",65 "fallthrough",66 "for",67 "func",68 "go",69 "goto",70 "if",71 "import",72 "interface",73 "map",74 "package",75 "range",76 "return",77 "select",78 "struct",79 "switch",80 "type",81 "var",82 ];83 const KEYWORDS = {84 keyword: KWS,85 type: TYPES,86 literal: LITERALS,87 built_in: BUILT_INS88 };89 return {90 name: 'Go',91 aliases: [ 'golang' ],92 keywords: KEYWORDS,93 illegal: '</',94 contains: [95 hljs.C_LINE_COMMENT_MODE,96 hljs.C_BLOCK_COMMENT_MODE,97 {98 className: 'string',99 variants: [100 hljs.QUOTE_STRING_MODE,101 hljs.APOS_STRING_MODE,102 {103 begin: '`',104 end: '`'105 }106 ]107 },108 {109 className: 'number',110 variants: [111 {112 match: /-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/, // hex without a present digit before . (making a digit afterwards required)113 relevance: 0114 },115 {116 match: /-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/, // hex with a present digit before . (making a digit afterwards optional)117 relevance: 0118 },119 {120 match: /-?\b0[oO](_?[0-7])*i?/, // leading 0o octal121 relevance: 0122 },123 {124 match: /-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/, // decimal without a present digit before . (making a digit afterwards required)125 relevance: 0126 },127 {128 match: /-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/, // decimal with a present digit before . (making a digit afterwards optional)129 relevance: 0130 }131 ]132 },133 { begin: /:=/ // relevance booster134 },135 {136 className: 'function',137 beginKeywords: 'func',138 end: '\\s*(\\{|$)',139 excludeEnd: true,140 contains: [141 hljs.TITLE_MODE,142 {143 className: 'params',144 begin: /\(/,145 end: /\)/,146 endsParent: true,147 keywords: KEYWORDS,148 illegal: /["']/149 }150 ]151 }152 ]153 };154}155 156export { go as default };157 