Golang go/token.Token.IsOperator function example
package go/token
IsOperator returns true for tokens corresponding to operators and delimiters; it returns false otherwise.
Golang go/token.Token.IsOperator function usage example
// getClass returns the CSS class name associated with tok.
func (h *Highlighter) getClass(tok token.Token) string {
switch {
case tok.IsKeyword():
return h.KeywordClass
case tok.IsLiteral(): // <---- here
if tok == token.IDENT {
return h.IdentClass
} else {
return h.LiteralClass
}
case tok.IsOperator():
return h.OperatorClass
case tok == token.COMMENT:
return h.CommentClass
case tok == token.ILLEGAL:
break
default:
panic(fmt.Sprintf("unknown token type: %v", tok))
}
return ""
}
References :
Advertisement
Something interesting
Tutorials
+14.6k Golang : Missing Bazaar command
+8.1k Golang : Check from web if Go application is running or not
+4.9k Python : Find out the variable type and determine the type with simple test
+6.3k Apt-get to install and uninstall Golang
+7.7k Gogland : Where to put source code files in package directory for rookie
+22.1k Golang : Join arrays or slices example
+4.9k Unix/Linux : secure copying between servers with SCP command examples
+7.1k Golang : Squaring elements in array
+7.5k Golang : Rename part of filename
+9.2k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+16.3k Golang : convert string or integer to big.Int type
+19.1k Mac OSX : Homebrew and Golang