diff options
Diffstat (limited to 'pygments/lexers/compiled.py')
-rw-r--r-- | pygments/lexers/compiled.py | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index ffa4081f..450a9c4d 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -1822,25 +1822,33 @@ class GoLexer(RegexLexer): (r'//(.*?)\n', Comment.Single), (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), (r'(import|package)\b', Keyword.Namespace), - (r'(var|func|struct|type|interface|const)\b', Keyword.Declaration), - (r'(break|default|select|case|defer|go|map' - r'|chan|else|goto|switch|fallthrough|if|range' + (r'(var|func|struct|map|chan|type|interface|const)\b', Keyword.Declaration), + (r'(break|default|select|case|defer|go' + r'|else|goto|switch|fallthrough|if|range' r'|continue|for|return)\b', Keyword ), + (r'(true|false|iota|nil)\b', Keyword.Constant), # It seems the builtin types aren't actually keywords, but # can be used as functions. So we need two declarations. - (r'(uint8|uint16|uint32|uint64' - r'|int8|int16|int32|int64' - r'|float32|float64|byte|error' - r'|uint|int|float|uintptr' - r'|string|close|closed|len|cap|new|make)\b(\()', bygroups(Name.Builtin, Punctuation) + (r'(uint|uint8|uint16|uint32|uint64' + r'|int|int8|int16|int32|int64' + r'|float|float32|float64' + r'|complex64|complex128|byte|rune' + r'|string|bool|error|uintptr' + r'|print|println|panic|recover|close|complex|real|imag' + r'|len|cap|append|copy|delete|new|make)\b(\()', bygroups(Name.Builtin, Punctuation) ), - (r'(uint8|uint16|uint32|uint64' - r'|int8|int16|int32|int64' - r'|float32|float64|byte|error' - r'|uint|int|float|uintptr' - r'|string)\b', Keyword.Type + (r'(uint|uint8|uint16|uint32|uint64' + r'|int|int8|int16|int32|int64' + r'|float|float32|float64' + r'|complex64|complex128|byte|rune' + r'|string|bool|error|uintptr)\b', Keyword.Type ), + # imaginary_lit + (r'\d+i', Number), + (r'\d+\.\d*([Ee][-+]\d+)?i', Number), + (r'\.\d+([Ee][-+]\d+)?i', Number), + (r'\d+[Ee][-+]\d+i', Number), # float_lit (r'\d+(\.\d+[eE][+\-]?\d+|' r'\.\d*|[eE][+\-]?\d+)', Number.Float), |