summaryrefslogtreecommitdiff
path: root/pygments/lexers/objective.py
diff options
context:
space:
mode:
authorStephen Celis <stephen@stephencelis.com>2014-10-29 12:05:12 -0700
committerStephen Celis <stephen@stephencelis.com>2014-10-29 12:05:12 -0700
commit1229397ede7ad691887421cd0ba94667e7fad2d5 (patch)
treea50d5407d749db62276241c57151651b1c37cd6a /pygments/lexers/objective.py
parent3d9bf3a9b9164be4d7b9cc33b5fbcf84cdcbc36d (diff)
downloadpygments-1229397ede7ad691887421cd0ba94667e7fad2d5.tar.gz
Swift: PR Fixes
- Fix prematurely popped states - Fix @availability - Fix single-digit floats
Diffstat (limited to 'pygments/lexers/objective.py')
-rw-r--r--pygments/lexers/objective.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/pygments/lexers/objective.py b/pygments/lexers/objective.py
index 8c974520..4e0ecf09 100644
--- a/pygments/lexers/objective.py
+++ b/pygments/lexers/objective.py
@@ -392,7 +392,7 @@ class SwiftLexer(RegexLexer):
# Hexadecimal Literal
(r'0x[0-9a-fA-F_]+', Number.Hex),
# Decimal Literal
- (r'[0-9][0-9_]+(\.[0-9_]+[eE][+\-]?[0-9_]+|'
+ (r'[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|'
r'\.[0-9_]*|[eE][+\-]?[0-9_]+)', Number.Float),
(r'[0-9][0-9_]*', Number.Integer),
# String Literal
@@ -408,10 +408,11 @@ class SwiftLexer(RegexLexer):
'keywords': [
(r'(break|case|continue|default|do|else|fallthrough|for|if|in'
r'|return|switch|where|while)\b', Keyword),
+ (r'@availability\([^)]+\)', Keyword.Reserved),
(r'(associativity|convenience|dynamic|didSet|final|get|infix|inout'
r'|lazy|left|mutating|none|nonmutating|optional|override|postfix'
r'|precedence|prefix|Protocol|required|right|set|Type|unowned|weak'
- r'|willSet|@(availability\([^)]*\)|autoclosure|noreturn'
+ r'|willSet|@(availability|autoclosure|noreturn'
r'|NSApplicationMain|NSCopying|NSManaged|objc'
r'|UIApplicationMain|IBAction|IBDesignable|IBInspectable'
r'|IBOutlet))\b',Keyword.Reserved),
@@ -435,7 +436,7 @@ class SwiftLexer(RegexLexer):
# Nested
'comment-single': [
- default('#pop'),
+ (r'\n', Text, '#pop'),
include('comment'),
(r'[^\n]', Comment.Single)
],
@@ -447,12 +448,12 @@ class SwiftLexer(RegexLexer):
(r'[*/]', Comment.Multiline)
],
'module': [
- default('#pop'),
+ (r'\n', Text, '#pop'),
(r'[a-zA-Z_]\w*', Name.Class),
include('root')
],
'preproc': [
- default('#pop'),
+ (r'\n', Text, '#pop'),
include('keywords'),
(r'[A-Za-z]\w*', Comment.Preproc),
include('root')