Skip to content

Instantly share code, notes, and snippets.

@nathany nathany/go.cson
Created Oct 4, 2014

Embed
What would you like to do?
Atom conversion of GoSublime-next.tmLanguage
'comment': 'Based on work from github.com/frou/GoFeather and github.com/DisposaBoy/GoSublime'
'fileTypes': [
'go'
]
'firstLineMatch': '-[*]-( Mode:)? Go -[*]-'
'name': 'GoSublime-next'
'patterns': [
{
'begin': '/\\*'
'end': '\\*/'
'name': 'comment.block.go'
}
{
'begin': '//'
'end': '\\z'
'name': 'comment.line.double-slash.go'
}
{
'begin': '"'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.go'
'end': '"'
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.go'
'name': 'string.quoted.double.go'
'patterns': [
{
'include': '#string_placeholder'
}
{
'include': '#string_escaped_char'
}
]
}
{
'begin': '`'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.go'
'end': '`'
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.go'
'name': 'string.quoted.raw.go'
'patterns': [
{
'include': '#string_placeholder'
}
{
'include': 'source.gotemplate'
}
]
}
{
'match': '\\b(true|false|nil|iota)\\b'
'name': 'constant.language.go'
}
{
'match': '\\b((\\d+\\.(\\d+)?([eE][+-]?\\d+)?|\\d+[eE][+-]?\\d+|\\.\\d+([eE][+-]?\\d+)?)i?)\\b'
'name': 'constant.numeric.floating-point.go'
}
{
'match': '\\b(\\d+i|0[xX][0-9A-Fa-f]+|0[0-7]*|[1-9][0-9]*)\\b'
'name': 'constant.numeric.integer.go'
}
{
'match': '\'(?:[^\'\\\\]|\\\\(?:\\\\|[abfnrtv\']|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3}))\''
'name': 'constant.other.rune.go'
}
{
'match': '\\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64)?|uintptr)\\b'
'name': 'storage.type.go'
}
{
'comment': 'A subset of keyword.other.go for flow control keywords.'
'match': '\\b(break|case|continue|default|defer|else|for|go|goto|if|range|return|select|switch)\\b'
'name': 'keyword.control.go'
}
{
'match': '\\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)\\b'
'name': 'keyword.other.go'
}
{
'captures':
'0':
'name': 'variable.other.go'
'1':
'name': 'keyword.operator.initialize.go'
'comment': 'This matches the \'x := 0\' style of variable declaration.'
'match': '(?:[[:alpha:]_][[:alnum:]_]*)(?:,\\s+[[:alpha:]_][[:alnum:]_]*)*\\s*(:=)'
'name': 'meta.initialization.short.go'
}
{
'match': '(?<=(\\Afunc|...\\))\\s)\\b(\\w+)\\b(?=\\()'
'name': 'entity.name.function.go'
}
{
'match': '(?<=(\\sfunc|....\\))\\s)\\b(\\w+)\\b(?=\\()'
'name': 'entity.name.function.go'
}
{
'match': '(?<=\\Atype\\s)\\b(\\w+)\\b'
'name': 'entity.name.type.go'
}
{
'match': '(?<=\\stype\\s)\\b(\\w+)\\b'
'name': 'entity.name.type.go'
}
{
'match': '\\b(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\\b'
'name': 'support.function.builtin.go'
}
{
'match': '\\b(\\w+)\\b(?=\\()'
'name': 'support.function.go'
}
{
'match': '(<-)'
'name': 'keyword.operator.channel.go'
}
]
'repository':
'string_escaped_char':
'patterns': [
{
'match': '\\\\(\\\\|[abfnrtv\'"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3})'
'name': 'constant.character.escape.go'
}
{
'match': '\\\\.'
'name': 'invalid.illegal.unknown-escape.go'
}
]
'string_placeholder':
'patterns': [
{
'match': '(?x)%\n (\\d+\\$)? # field (argument #)\n [#0\\- +\']* # flags\n [,;:_]? # separator character (AltiVec)\n ((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n (\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n [diouxXDOUeEfFgGaAcCsSqpnvtTbyYhHmMzZ%] # conversion type\n '
'name': 'constant.other.placeholder.go'
}
{
'match': '%'
'name': 'invalid.illegal.placeholder.go'
}
]
'scopeName': 'source.go'
@nathany

This comment has been minimized.

Copy link
Owner Author

nathany commented Oct 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.