`language_python`: Add new patterns (#1074)

* `language_python`:  Add new patterns

This commit provides:
 - multiline comments support;
 - unicode string symbol highlighting;
 - class names as keyword2.
This commit is contained in:
Cyriaque Skrapits 2022-07-13 17:06:42 +02:00 committed by GitHub
parent 2dac3667cb
commit af3e2c971c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -6,8 +6,12 @@ syntax.add {
files = { "%.py$", "%.pyw$", "%.rpy$" },
headers = "^#!.*[ /]python",
comment = "#",
block_comment = { '"""', '"""' },
patterns = {
{ pattern = "#.*", type = "comment" },
{ pattern = { '^%s*"""', '"""' }, type = "comment" },
{ pattern = '[uUrR]%f["]', type = "keyword" },
{ pattern = "class%s+()[%a_][%w_]*", type = {"keyword", "keyword2"} },
{ pattern = { '[ruU]?"""', '"""'; '\\' }, type = "string" },
{ pattern = { "[ruU]?'''", "'''", '\\' }, type = "string" },
{ pattern = { '[ruU]?"', '"', '\\' }, type = "string" },