Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Adds new keywords for match statements #338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions grammars/python.cson
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
{
'comment': 'keywords that delimit flow conditionals'
'name': 'keyword.control.conditional.python'
'match': '\\b(if|elif|else)\\b'
'match': '\\b(if|elif|else|match|case)\\b'
}
{
'comment': 'keywords that delimit an exception'
Expand Down Expand Up @@ -848,7 +848,7 @@
'generic_names':
'match': '[A-Za-z_][A-Za-z0-9_]*'
'illegal_names':
'match': '\\b(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield|await|async)\\b'
'match': '\\b(and|as|assert|break|class|continue|def|del|elif|else|match|case|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield|await|async)\\b'
'name': 'invalid.illegal.name.python'
'keyword_arguments':
'begin': '\\b([a-zA-Z_][a-zA-Z_0-9]*)\\s*(=)(?!=)'
Expand Down
4 changes: 4 additions & 0 deletions grammars/tree-sitter-python.cson
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ folds: [
'if_statement'
'elif_clause'
'else_clause'
'match_statement'
'case_clause'
'for_statement'
'try_statement'
'with_statement'
Expand Down Expand Up @@ -126,6 +128,8 @@ scopes:
'"if"': 'keyword.control'
'"else"': 'keyword.control'
'"elif"': 'keyword.control'
'"match"': 'keyword.control'
'"case"': 'keyword.control'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these work when Tree-sitter is enabled? I would think that the Tree-sitter parser would need to be upgraded to have the match and case keywords parsed.

'"while"': 'keyword.control'
'"for"': 'keyword.control'
'"return"': 'keyword.control'
Expand Down
4 changes: 2 additions & 2 deletions settings/language-python.cson
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
'tabLength': 4
'commentStart': '# '
'foldEndPattern': '^\\s*[}\\])]'
'increaseIndentPattern': '^\\s*(class|def|elif|else|except|finally|for|if|try|with|while|async\\s+(def|for|with))\\b.*:\\s*$'
'decreaseIndentPattern': '^\\s*(elif|else|except|finally)\\b.*:\\s*$'
'increaseIndentPattern': '^\\s*(class|def|elif|else|match|case|except|finally|for|if|try|with|while|async\\s+(def|for|with))\\b.*:\\s*$'
'decreaseIndentPattern': '^\\s*(elif|else|case|except|finally)\\b.*:\\s*$'