From 72c1e8bae214a0549fce85fdddb79e25b6cc1025 Mon Sep 17 00:00:00 2001 From: Andy Li Date: Wed, 20 Feb 2013 23:34:43 +0800 Subject: Improved cast. --- pygments/lexers/web.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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')), -- cgit v1.2.1