From 25273ed077997a0ed8ca8bcf34be7b94e248c5cb Mon Sep 17 00:00:00 2001 From: Andy Li Date: Sun, 16 Dec 2012 03:53:46 +0800 Subject: haxe3 pattern matching. --- pygments/lexers/web.py | 4 ++-- 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 Void> { private function new():Void { -- cgit v1.2.1