Georg Brandl avatar Georg Brandl committed 34967a9 Merge

Merged in thechriswalker/pygments-main (pull request #106)

Comments (0)

Files changed (1)

pygments/lexers/compiled.py

             (r'\\\n', Text), # line continuations
             (r'//(.*?)\n', Comment.Single),
             (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
-            (r'(break|default|func|interface|select'
-             r'|case|defer|go|map|struct'
-             r'|chan|else|goto|package|switch'
-             r'|const|fallthrough|if|range|type'
-             r'|continue|for|import|return|var)\b', Keyword
+            (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'|continue|for|return)\b', Keyword
             ),
-            # It seems the builtin types aren't actually keywords.
+            # 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'
+             r'|float32|float64|byte|error'
              r'|uint|int|float|uintptr'
-             r'|string|close|closed|len|cap|new|make)\b', Name.Builtin
+             r'|string|close|closed|len|cap|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
             ),
             # float_lit
             (r'\d+(\.\d+[eE][+\-]?\d+|'
             (r'"(\\\\|\\"|[^"])*"', String),
             # Tokens
             (r'(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\|'
-             r'|<-|\+\+|--|==|!=|:=|\.\.\.)|[+\-*/%&|^<>=!()\[\]{}.,;:]',
-             Punctuation
-            ),
+             r'|<-|\+\+|--|==|!=|:=|\.\.\.|[+\-*/%&])', Operator),
+            (r'[|^<>=!()\[\]{}.,;:]', Punctuation),
             # identifier
-            (r'[a-zA-Z_]\w*', Name),
+            (r'[a-zA-Z_]\w*', Name.Other),
         ]
     }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.