From 96a518bb94afc8886300bbabb04d6f3ff6a54ba7 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Fri, 3 Mar 2023 14:14:44 +0100 Subject: [PATCH] [Python]Add match and case to Keywords (#756) --- lexers/embedded/python.xml | 2 +- .../test_structural_pattern_matching.actual | 5 ++++ .../test_structural_pattern_matching.expected | 23 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 lexers/testdata/python/test_structural_pattern_matching.actual create mode 100644 lexers/testdata/python/test_structural_pattern_matching.expected diff --git a/lexers/embedded/python.xml b/lexers/embedded/python.xml index a6e889c64..3c6af86e8 100644 --- a/lexers/embedded/python.xml +++ b/lexers/embedded/python.xml @@ -206,7 +206,7 @@ - + diff --git a/lexers/testdata/python/test_structural_pattern_matching.actual b/lexers/testdata/python/test_structural_pattern_matching.actual new file mode 100644 index 000000000..451b10ad7 --- /dev/null +++ b/lexers/testdata/python/test_structural_pattern_matching.actual @@ -0,0 +1,5 @@ +var = 1 + +match var: + case 1: + print("Test") diff --git a/lexers/testdata/python/test_structural_pattern_matching.expected b/lexers/testdata/python/test_structural_pattern_matching.expected new file mode 100644 index 000000000..c8523388a --- /dev/null +++ b/lexers/testdata/python/test_structural_pattern_matching.expected @@ -0,0 +1,23 @@ +[ + {"type":"Name","value":"var"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"="}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberInteger","value":"1"}, + {"type":"Text","value":"\n\n"}, + {"type":"Keyword","value":"match"}, + {"type":"Text","value":" "}, + {"type":"Name","value":"var"}, + {"type":"Punctuation","value":":"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"case"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberInteger","value":"1"}, + {"type":"Punctuation","value":":"}, + {"type":"Text","value":"\n "}, + {"type":"NameBuiltin","value":"print"}, + {"type":"Punctuation","value":"("}, + {"type":"LiteralStringDouble","value":"\"Test\""}, + {"type":"Punctuation","value":")"}, + {"type":"Text","value":"\n"} +]