Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test case for match & case
  • Loading branch information
jpe committed Dec 21, 2022
commit b00e6058f7c1a0001c42ef3648d036a5554b7c87
2 changes: 1 addition & 1 deletion test/examples/python/SciTE.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lexer.*.py=python
keywords.*.py=class def else for if import in pass print return while with yield
keywords.*.py=class def else for if import in pass print return while with yield match case
keywords2.*.py=hilight
fold=1
fold.compact=1
25 changes: 25 additions & 0 deletions test/examples/python/matchcase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Match and case as keywords
match (x):
case +1:
pass
case -1:
pass
case []:
pass

# Match and case as identifiers
match = 1
def match():
pass
match.group()
1 + match
case.attribute

# Unfortunately wrong classifications; should be rare in real code because
# non-call expressions usually don't begin lines, the exceptions are match(x)
# and case(x)
match(x)
case(x)
match + 1
case + 1
case[1]
26 changes: 26 additions & 0 deletions test/examples/python/matchcase.py.folded
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
0 400 0 # Match and case as keywords
2 400 0 + match (x):
2 404 0 + case +1:
0 408 0 | pass
2 404 0 + case -1:
0 408 0 | pass
2 404 0 + case []:
0 408 0 | pass
1 408 0 |
0 400 0 # Match and case as identifiers
0 400 0 match = 1
2 400 0 + def match():
0 404 0 | pass
0 400 0 match.group()
0 400 0 1 + match
0 400 0 case.attribute
1 400 0
0 400 0 # Unfortunately wrong classifications; should be rare in real code because
0 400 0 # non-call expressions usually don't begin lines, the exceptions are match(x)
0 400 0 # and case(x)
0 400 0 match(x)
0 400 0 case(x)
0 400 0 match + 1
0 400 0 case + 1
0 400 0 case[1]
1 400 0
25 changes: 25 additions & 0 deletions test/examples/python/matchcase.py.styled
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{1}# Match and case as keywords{0}
{5}match{0} {10}({11}x{10}):{0}
{5}case{0} {10}+{2}1{10}:{0}
{5}pass{0}
{5}case{0} {10}-{2}1{10}:{0}
{5}pass{0}
{5}case{0} {10}[]:{0}
{5}pass{0}

{1}# Match and case as identifiers{0}
{11}match{0} {10}={0} {2}1{0}
{5}def{0} {9}match{10}():{0}
{5}pass{0}
{11}match{10}.{11}group{10}(){0}
{2}1{0} {10}+{0} {11}match{0}
{11}case{10}.{11}attribute{0}

{1}# Unfortunately wrong classifications; should be rare in real code because{0}
{1}# non-call expressions usually don't begin lines, the exceptions are match(x){0}
{1}# and case(x){0}
{5}match{10}({11}x{10}){0}
{5}case{10}({11}x{10}){0}
{5}match{0} {10}+{0} {2}1{0}
{5}case{0} {10}+{0} {2}1{0}
{5}case{10}[{2}1{10}]{0}