summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/lexers/web.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py
index 51063e96..350f5b6c 100644
--- a/pygments/lexers/web.py
+++ b/pygments/lexers/web.py
@@ -1523,12 +1523,20 @@ class HaxeLexer(ExtendedRegexLexer):
(r'', Text, ('#pop', 'expr')),
],
+ # cast can be written as "cast expr" or "cast(expr, type)"
'cast': [
include('spaces'),
- (r'\(', Punctuation, ('#pop', 'parenthesis-close', 'type', 'comma', 'expr')),
+ (r'\(', Punctuation, ('#pop', 'parenthesis-close', 'cast-type', 'expr')),
(r'', Text, ('#pop', 'expr')),
],
+ # optionally give a type as the 2nd argument of cast()
+ 'cast-type': [
+ include('spaces'),
+ (r',', Punctuation, ('#pop', 'type')),
+ (r'', Text, '#pop'),
+ ],
+
'catch': [
include('spaces'),
(r'(?:catch)\b', Keyword, ('expr', 'function-param', 'parenthesis-open')),