diff options
author | Andy Li <andy@onthewings.net> | 2012-12-16 03:53:46 +0800 |
---|---|---|
committer | Andy Li <andy@onthewings.net> | 2012-12-16 03:53:46 +0800 |
commit | 25273ed077997a0ed8ca8bcf34be7b94e248c5cb (patch) | |
tree | 304a0b57d61e38debc6e539761f568cb66d8df20 | |
parent | 33342de19c0946e740713c2cd3e8946f0736f7d7 (diff) | |
download | pygments-25273ed077997a0ed8ca8bcf34be7b94e248c5cb.tar.gz |
haxe3 pattern matching.
-rw-r--r-- | pygments/lexers/web.py | 4 | ||||
-rw-r--r-- | tests/examplefiles/example.hx | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py index 95b7a104..4ce27a94 100644 --- a/pygments/lexers/web.py +++ b/pygments/lexers/web.py @@ -1535,7 +1535,7 @@ class HaxeLexer(ExtendedRegexLexer): 'switch': [ include('spaces'), - (r'\(', Text, ('#pop', 'switch-body', 'bracket-open', 'expr')), + (r'', Text, ('#pop', 'switch-body', 'bracket-open', 'expr')), ], 'switch-body': [ @@ -1558,7 +1558,7 @@ class HaxeLexer(ExtendedRegexLexer): 'case-guard': [ include('spaces'), - (r'(?:if)\b', Keyword, ('#pop', 'parenthesis')), + (r'(?:if)\b', Keyword, ('#pop', 'parenthesis', 'parenthesis-open')), (r'', Text, '#pop'), ], diff --git a/tests/examplefiles/example.hx b/tests/examplefiles/example.hx index 11c74fab..fd93bb49 100644 --- a/tests/examplefiles/example.hx +++ b/tests/examplefiles/example.hx @@ -69,6 +69,12 @@ switch(e.expr) { "5"; } +switch [true, 1, "foo"] { + case [true, 1, "foo"]: "0"; + case [true, 1, _]: "1"; + case _: "_"; +} + class Test <T:Void->Void> { private function new():Void { |