summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguy?n <minh@nguyen.cincinnati.oh.us>2016-03-10 07:16:59 +0000
committerMinh Nguy?n <minh@nguyen.cincinnati.oh.us>2016-03-10 07:16:59 +0000
commitd346a457fa86f973367c745f7f32c20ebf93edd3 (patch)
tree8df6898db1ff15b50602bb283d1a33dc89a538db
parent4210f7fcc432aeadc3fa71836626689f878abca8 (diff)
downloadpygments-d346a457fa86f973367c745f7f32c20ebf93edd3.tar.gz
Added Swift 2.2 keywords
-rw-r--r--pygments/lexers/objective.py25
1 files changed, 14 insertions, 11 deletions
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)),