Merge pull request #1590 from ajaxorg/go

Improved Go highlighting, added builtin types and functions
This commit is contained in:
Harutyun Amirjanyan 2013-09-06 02:14:59 -07:00
commit 5b6a1df596
2 changed files with 19 additions and 10 deletions

View file

@ -80,10 +80,10 @@
["paren.lparen","("], ["paren.lparen","("],
["identifier","n"], ["identifier","n"],
["text"," "], ["text"," "],
["identifier","int"], ["support.type","int"],
["paren.rparen",")"], ["paren.rparen",")"],
["text"," "], ["text"," "],
["identifier","float64"], ["support.type","float64"],
["text"," "], ["text"," "],
["paren.lparen","{"] ["paren.lparen","{"]
],[ ],[
@ -94,11 +94,11 @@
["punctuation.operator",":"], ["punctuation.operator",":"],
["keyword.operator","="], ["keyword.operator","="],
["text"," "], ["text"," "],
["identifier","make"], ["support.function","make"],
["paren.lparen","("], ["paren.lparen","("],
["keyword","chan"], ["keyword","chan"],
["text"," "], ["text"," "],
["identifier","float64"], ["support.type","float64"],
["paren.rparen",")"] ["paren.rparen",")"]
],[ ],[
"start", "start",
@ -134,7 +134,7 @@
["identifier","ch"], ["identifier","ch"],
["punctuation.operator",","], ["punctuation.operator",","],
["text"," "], ["text"," "],
["identifier","float64"], ["support.type","float64"],
["paren.lparen","("], ["paren.lparen","("],
["identifier","k"], ["identifier","k"],
["paren.rparen","))"] ["paren.rparen","))"]
@ -209,12 +209,12 @@
["text"," "], ["text"," "],
["keyword","chan"], ["keyword","chan"],
["text"," "], ["text"," "],
["identifier","float64"], ["support.type","float64"],
["punctuation.operator",","], ["punctuation.operator",","],
["text"," "], ["text"," "],
["identifier","k"], ["identifier","k"],
["text"," "], ["text"," "],
["identifier","float64"], ["support.type","float64"],
["paren.rparen",")"], ["paren.rparen",")"],
["text"," "], ["text"," "],
["paren.lparen","{"] ["paren.lparen","{"]

View file

@ -6,15 +6,24 @@ define(function(require, exports, module) {
var GolangHighlightRules = function() { var GolangHighlightRules = function() {
var keywords = ( var keywords = (
"else|break|case|return|goto|if|const|" + "else|break|case|return|goto|if|const|" +
"continue|struct|default|switch|for|" + "continue|struct|default|switch|for|range|" +
"func|import|package|chan|defer|fallthrough|go|interface|map|range" + "func|import|package|chan|defer|fallthrough|go|interface|map|range" +
"select|type|var" "select|type|var"
); );
var buildinConstants = ("nil|true|false|iota"); var builtinTypes = (
"string|uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|" +
"float64|complex64|complex128|byte|rune|uint|int|uintptr"
);
var builtinFunctions = (
"make|close|new"
);
var builtinConstants = ("nil|true|false|iota");
var keywordMapper = this.createKeywordMapper({ var keywordMapper = this.createKeywordMapper({
"keyword": keywords, "keyword": keywords,
"constant.language": buildinConstants "constant.language": builtinConstants,
"support.function": builtinFunctions,
"support.type": builtinTypes
}, "identifier"); }, "identifier");
this.$rules = { this.$rules = {