Skip to content

Instantly share code, notes, and snippets.

@mattheath
Last active August 29, 2015 14:07
Show Gist options
  • Save mattheath/f041d09c8be0e67d1d26 to your computer and use it in GitHub Desktop.
Save mattheath/f041d09c8be0e67d1d26 to your computer and use it in GitHub Desktop.
Modified Go language definition for Highlight
-- Language definition generated by lang2to3
-- Modified version of Go definition located somewhere like:
-- {$HOMEBREW_ROOT}/Cellar/highlight/3.14/share/highlight/langDefs/go.lang
Description="Go"
Keywords={
{ Id=1,
List={"break", "default", "func", "interface", "select", "case", "defer", "go", "map", "struct", "chan", "else", "goto", "package", "switch", "const", "fallthrough", "if", "range", "type", "continue", "for", "import", "return", "var"},
},
{ Id=2,
-- builtin types
List={"bool", "byte", "complex64", "complex128", "float32", "float64", "int8", "int16", "int32", "int64", "string", "uint8", "uint16", "uint32", "uint64", "float", "int", "uint", "uintptr"},
},
{ Id=3,
List={"true", "false", "iota", "nil"},
},
{ Id=4,
-- calling methods on structs
Regex=[[\.(\w+)\s*\(]],
},
{ Id=5,
-- defining methods
Regex=[[(\w+)\s*\(]],
},
{ Id=6,
-- builtins
List={"append", "cap", "close", "complex", "copy", "delete", "imag", "len", "make", "new", "panic", "print", "println", "real", "recover"},
},
{ Id=7,
Regex=[[\+=|\+\+|&=|&&|&\^|&\^=|&|==|!=|:=|\|=|-=|\*=|<<=|>>=|<=|>=|<<|>>|<-|<|>|\^=|\^|\/=|=|-|\||\*|\+|\!|%]],
},
}
--# raw strings ` not implemented yet
Strings={
Delimiter=[["|'|`]],
Escape=[=[ \\\d{3}|\\x[[:xdigit:]]{2}|\\u[[:xdigit:]]{4}|\\U[[:xdigit:]]{8}|\\[ntvbrfa\\\?'"] ]=]
}
IgnoreCase=false
Comments={
{ Block=false,
Delimiter= { [[//]] },
},
{ Block=true,
Nested=false,
Delimiter= { [[\/\*]],[[\*\/]],}
}
}
Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\^]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment