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.4k Golang : On enumeration
+27.6k PHP : Convert(cast) string to bigInt
+16.4k CodeIgniter/PHP : Create directory if does not exist example
+10.2k Golang : Use regular expression to get all upper case or lower case characters example
+5.9k Golang : Denco multiplexer example
+15.6k Golang : Convert date format and separator yyyy-mm-dd to dd-mm-yyyy
+30.9k Golang : Interpolating or substituting variables in string examples
+13.6k Golang : reCAPTCHA example
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+4.7k Javascript : Access JSON data example
+23.9k Golang : Fix type interface{} has no field or no methods and type assertions example
+7.2k Golang : Dealing with postal or zip code example