diff options
author | Georg Brandl <georg@python.org> | 2016-03-17 07:36:42 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2016-03-17 07:36:42 +0100 |
commit | 4470df49411dfdf9ba70d74c7ca0880ad88bf078 (patch) | |
tree | 32eb7b488a4212467084541ebac17801a7b67520 | |
parent | 03710b6a5d751692f7c8c3551b956030a28de10d (diff) | |
parent | dc54566e1da4c2a17d45312d7490c27fed86cb05 (diff) | |
download | pygments-git-4470df49411dfdf9ba70d74c7ca0880ad88bf078.tar.gz |
Merged in miikkas/pygments-cssimprovements (pull request #566)
Improve CSS lexer, fix #1130 and #1083
-rw-r--r-- | pygments/lexers/c_cpp.py | 11 | ||||
-rw-r--r-- | pygments/lexers/objective.py | 25 |
2 files changed, 20 insertions, 16 deletions
diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py index 632871ba..a8d75c0a 100644 --- a/pygments/lexers/c_cpp.py +++ b/pygments/lexers/c_cpp.py @@ -61,10 +61,11 @@ class CFamilyLexer(RegexLexer): (r'\*/', Error), (r'[~!%^&*+=|?:<>/-]', Operator), (r'[()\[\],.]', Punctuation), - (words(('auto', 'break', 'case', 'const', 'continue', 'default', 'do', - 'else', 'enum', 'extern', 'for', 'goto', 'if', 'register', - 'restricted', 'return', 'sizeof', 'static', 'struct', - 'switch', 'typedef', 'union', 'volatile', 'while'), + (words(('asm', 'auto', 'break', 'case', 'const', 'continue', + 'default', 'do', 'else', 'enum', 'extern', 'for', 'goto', + 'if', 'register', 'restricted', 'return', 'sizeof', + 'static', 'struct', 'switch', 'typedef', 'union', + 'volatile', 'while'), suffix=r'\b'), Keyword), (r'(bool|int|long|float|short|double|char|unsigned|signed|void)\b', Keyword.Type), @@ -208,7 +209,7 @@ class CppLexer(CFamilyLexer): tokens = { 'statements': [ (words(( - 'asm', 'catch', 'const_cast', 'delete', 'dynamic_cast', 'explicit', + 'catch', 'const_cast', 'delete', 'dynamic_cast', 'explicit', 'export', 'friend', 'mutable', 'namespace', 'new', 'operator', 'private', 'protected', 'public', 'reinterpret_cast', 'restrict', 'static_cast', 'template', 'this', 'throw', 'throws', diff --git a/pygments/lexers/objective.py b/pygments/lexers/objective.py index fc8e5d17..ba1e0bae 100644 --- a/pygments/lexers/objective.py +++ b/pygments/lexers/objective.py @@ -298,7 +298,7 @@ class SwiftLexer(RegexLexer): (r'\s+', Text), (r'//', Comment.Single, 'comment-single'), (r'/\*', Comment.Multiline, 'comment-multi'), - (r'#(if|elseif|else|endif)\b', Comment.Preproc, 'preproc'), + (r'#(if|elseif|else|endif|available)\b', Comment.Preproc, 'preproc'), # Keywords include('keywords'), @@ -413,23 +413,26 @@ class SwiftLexer(RegexLexer): ], 'keywords': [ (words(( - 'break', 'case', 'continue', 'default', 'do', 'else', - 'fallthrough', 'for', 'if', 'in', 'return', 'switch', 'where', - 'while'), suffix=r'\b'), + 'as', 'break', 'case', 'catch', 'continue', 'default', 'defer', + 'do', 'else', 'fallthrough', 'for', 'guard', 'if', 'in', 'is', + 'repeat', 'return', '#selector', 'switch', 'throw', 'try', + 'where', 'while'), suffix=r'\b'), Keyword), (r'@availability\([^)]+\)', Keyword.Reserved), (words(( 'associativity', 'convenience', 'dynamic', 'didSet', 'final', - 'get', 'infix', 'inout', 'lazy', 'left', 'mutating', 'none', - 'nonmutating', 'optional', 'override', 'postfix', 'precedence', - 'prefix', 'Protocol', 'required', 'right', 'set', 'Type', - 'unowned', 'weak', 'willSet', '@availability', '@autoclosure', - '@noreturn', '@NSApplicationMain', '@NSCopying', '@NSManaged', - '@objc', '@UIApplicationMain', '@IBAction', '@IBDesignable', + 'get', 'indirect', 'infix', 'inout', 'lazy', 'left', 'mutating', + 'none', 'nonmutating', 'optional', 'override', 'postfix', + 'precedence', 'prefix', 'Protocol', 'required', 'rethrows', + 'right', 'set', 'throws', 'Type', 'unowned', 'weak', 'willSet', + '@availability', '@autoclosure', '@noreturn', + '@NSApplicationMain', '@NSCopying', '@NSManaged', '@objc', + '@UIApplicationMain', '@IBAction', '@IBDesignable', '@IBInspectable', '@IBOutlet'), suffix=r'\b'), Keyword.Reserved), (r'(as|dynamicType|false|is|nil|self|Self|super|true|__COLUMN__' - r'|__FILE__|__FUNCTION__|__LINE__|_)\b', Keyword.Constant), + r'|__FILE__|__FUNCTION__|__LINE__|_' + r'|#(?:file|line|column|function))\b', Keyword.Constant), (r'import\b', Keyword.Declaration, 'module'), (r'(class|enum|extension|struct|protocol)(\s+)([a-zA-Z_]\w*)', bygroups(Keyword.Declaration, Text, Name.Class)), |