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 11:06:42 -04:00
committed by GitHub
parent 2dac3667cb
commit af3e2c971c
+4
View File
@@ -6,8 +6,12 @@ syntax.add {
files = { "%.py$", "%.pyw$", "%.rpy$" }, files = { "%.py$", "%.pyw$", "%.rpy$" },
headers = "^#!.*[ /]python", headers = "^#!.*[ /]python",
comment = "#", comment = "#",
block_comment = { '"""', '"""' },
patterns = { patterns = {
{ pattern = "#.*", type = "comment" }, { 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" }, { pattern = { "[ruU]?'''", "'''", '\\' }, type = "string" },
{ pattern = { '[ruU]?"', '"', '\\' }, type = "string" }, { pattern = { '[ruU]?"', '"', '\\' }, type = "string" },