diff options
author | Andy Li <andy@onthewings.net> | 2013-02-20 23:34:43 +0800 |
---|---|---|
committer | Andy Li <andy@onthewings.net> | 2013-02-20 23:34:43 +0800 |
commit | 72c1e8bae214a0549fce85fdddb79e25b6cc1025 (patch) | |
tree | 09f7ba498043281213efc80ae4cf9f4447179fb4 | |
parent | a18a00420ef122cb7e4fc937d2fcbeef58ba1670 (diff) | |
download | pygments-72c1e8bae214a0549fce85fdddb79e25b6cc1025.tar.gz |
Improved cast.
-rw-r--r-- | pygments/lexers/web.py | 10 |
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')), |