mirror of
https://github.com/alecthomas/chroma.git
synced 2025-01-28 03:29:41 +02:00
[Python]Add match and case to Keywords (#756)
This commit is contained in:
parent
ecb69ce50b
commit
96a518bb94
@ -206,7 +206,7 @@
|
||||
</rule>
|
||||
</state>
|
||||
<state name="keywords">
|
||||
<rule pattern="(yield from|nonlocal|continue|finally|except|lambda|assert|global|return|raise|yield|while|break|await|async|pass|else|elif|with|try|for|del|as|if)\b">
|
||||
<rule pattern="(yield from|nonlocal|continue|finally|except|lambda|assert|global|return|raise|yield|while|break|await|async|pass|else|elif|with|try|for|del|as|if|match|case)\b">
|
||||
<token type="Keyword"/>
|
||||
</rule>
|
||||
<rule pattern="(False|True|None)\b">
|
||||
|
5
lexers/testdata/python/test_structural_pattern_matching.actual
vendored
Normal file
5
lexers/testdata/python/test_structural_pattern_matching.actual
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
var = 1
|
||||
|
||||
match var:
|
||||
case 1:
|
||||
print("Test")
|
23
lexers/testdata/python/test_structural_pattern_matching.expected
vendored
Normal file
23
lexers/testdata/python/test_structural_pattern_matching.expected
vendored
Normal file
@ -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"}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user