mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Merge pull request #3111 from soof-golan/soof/python-3.10-support
Add Python 3.10 keyword support
This commit is contained in:
commit
12d4d82bdf
1 changed files with 6 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ export const conf: languages.LanguageConfiguration = {
|
||||||
onEnterRules: [
|
onEnterRules: [
|
||||||
{
|
{
|
||||||
beforeText: new RegExp(
|
beforeText: new RegExp(
|
||||||
'^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$'
|
'^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async|match|case).*?:\\s*$'
|
||||||
),
|
),
|
||||||
action: { indentAction: languages.IndentAction.Indent }
|
action: { indentAction: languages.IndentAction.Indent }
|
||||||
}
|
}
|
||||||
|
|
@ -52,18 +52,21 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
|
|
||||||
keywords: [
|
keywords: [
|
||||||
// This section is the result of running
|
// This section is the result of running
|
||||||
// `for k in keyword.kwlist: print(' "' + k + '",')` in a Python REPL,
|
// `import keyword; for k in sorted(keyword.kwlist + keyword.softkwlist): print(" '" + k + "',")`
|
||||||
|
// in a Python REPL,
|
||||||
// though note that the output from Python 3 is not a strict superset of the
|
// though note that the output from Python 3 is not a strict superset of the
|
||||||
// output from Python 2.
|
// output from Python 2.
|
||||||
'False', // promoted to keyword.kwlist in Python 3
|
'False', // promoted to keyword.kwlist in Python 3
|
||||||
'None', // promoted to keyword.kwlist in Python 3
|
'None', // promoted to keyword.kwlist in Python 3
|
||||||
'True', // promoted to keyword.kwlist in Python 3
|
'True', // promoted to keyword.kwlist in Python 3
|
||||||
|
'_', // new in Python 3.10
|
||||||
'and',
|
'and',
|
||||||
'as',
|
'as',
|
||||||
'assert',
|
'assert',
|
||||||
'async', // new in Python 3
|
'async', // new in Python 3
|
||||||
'await', // new in Python 3
|
'await', // new in Python 3
|
||||||
'break',
|
'break',
|
||||||
|
'case', // new in Python 3.10
|
||||||
'class',
|
'class',
|
||||||
'continue',
|
'continue',
|
||||||
'def',
|
'def',
|
||||||
|
|
@ -81,6 +84,7 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'in',
|
'in',
|
||||||
'is',
|
'is',
|
||||||
'lambda',
|
'lambda',
|
||||||
|
'match', // new in Python 3.10
|
||||||
'nonlocal', // new in Python 3
|
'nonlocal', // new in Python 3
|
||||||
'not',
|
'not',
|
||||||
'or',
|
'or',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue