diff --git a/lexers/go.go b/lexers/go.go index 77bc2259c..266289b7c 100644 --- a/lexers/go.go +++ b/lexers/go.go @@ -55,7 +55,7 @@ func goRules() Rules { {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, {`(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\||<-|\+\+|--|==|!=|:=|\.\.\.|[+\-*/%&])`, Operator, nil}, {`([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(NameFunction, UsingSelf("root"), Punctuation), nil}, - {`[|^<>=!()\[\]{}.,;:]`, Punctuation, nil}, + {`[|^<>=!()\[\]{}.,;:~]`, Punctuation, nil}, {`[^\W\d]\w*`, NameOther, nil}, }, } diff --git a/lexers/testdata/go.actual b/lexers/testdata/go.actual index 4da3e5c9e..ea33e6cc9 100644 --- a/lexers/testdata/go.actual +++ b/lexers/testdata/go.actual @@ -15,4 +15,8 @@ func hello(a int) { return func() int { return i } -} // One last thing \ No newline at end of file +} // One last thing + +type Int interface { + ~int | ~int8 | ~int16 | ~int32 | ~int64 +} diff --git a/lexers/testdata/go.expected b/lexers/testdata/go.expected index 5775eda5a..9860d43e8 100644 --- a/lexers/testdata/go.expected +++ b/lexers/testdata/go.expected @@ -84,5 +84,39 @@ {"type":"Text","value":"\n"}, {"type":"Punctuation","value":"}"}, {"type":"Text","value":" "}, - {"type":"CommentSingle","value":"// One last thing\n"} + {"type":"CommentSingle","value":"// One last thing\n"}, + {"type":"Text","value":"\n"}, + {"type":"KeywordDeclaration","value":"type"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"Int"}, + {"type":"Text","value":" "}, + {"type":"KeywordDeclaration","value":"interface"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n\t"}, + {"type":"Punctuation","value":"~"}, + {"type":"KeywordType","value":"int"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"|"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"~"}, + {"type":"KeywordType","value":"int8"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"|"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"~"}, + {"type":"KeywordType","value":"int16"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"|"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"~"}, + {"type":"KeywordType","value":"int32"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"|"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"~"}, + {"type":"KeywordType","value":"int64"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"} ]