diff options
| author | rxi <rxi@users.noreply.github.com> | 2019-12-28 11:16:32 +0000 |
|---|---|---|
| committer | rxi <rxi@users.noreply.github.com> | 2019-12-28 11:17:56 +0000 |
| commit | d8c4bfa6bad7153486fd68f8c9368dc3bb458ce5 (patch) | |
| tree | 296b4e8d51b4cf60d7a6f809f2886b79cdb29981 /data/plugins/language_python.lua | |
| download | lite-xl-d8c4bfa6bad7153486fd68f8c9368dc3bb458ce5.tar.gz lite-xl-d8c4bfa6bad7153486fd68f8c9368dc3bb458ce5.zip | |
Initial commit
Diffstat (limited to 'data/plugins/language_python.lua')
| -rw-r--r-- | data/plugins/language_python.lua | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/data/plugins/language_python.lua b/data/plugins/language_python.lua new file mode 100644 index 00000000..ef79f234 --- /dev/null +++ b/data/plugins/language_python.lua @@ -0,0 +1,54 @@ +local syntax = require "core.syntax" + +syntax.add { + files = "%.py$", + comment = "#", + patterns = { + { pattern = { "#", "\n" }, type = "comment" }, + { pattern = { '[ruU]?"', '"', '\\' }, type = "string" }, + { pattern = { "[ruU]?'", "'", '\\' }, type = "string" }, + { pattern = { '"""', '"""' }, type = "string" }, + { pattern = "0x[%da-fA-F]+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*", type = "number" }, + { pattern = "-?%.?%d+", type = "number" }, + { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + }, + symbols = { + ["class"] = "keyword", + ["finally"] = "keyword", + ["is"] = "keyword", + ["return"] = "keyword", + ["continue"] = "keyword", + ["for"] = "keyword", + ["lambda"] = "keyword", + ["try"] = "keyword", + ["def"] = "keyword", + ["from"] = "keyword", + ["nonlocal"] = "keyword", + ["while"] = "keyword", + ["and"] = "keyword", + ["global"] = "keyword", + ["not"] = "keyword", + ["with"] = "keyword", + ["as"] = "keyword", + ["elif"] = "keyword", + ["if"] = "keyword", + ["or"] = "keyword", + ["else"] = "keyword", + ["import"] = "keyword", + ["pass"] = "keyword", + ["break"] = "keyword", + ["except"] = "keyword", + ["in"] = "keyword", + ["del"] = "keyword", + ["raise"] = "keyword", + ["yield"] = "keyword", + ["assert"] = "keyword", + ["self"] = "keyword2", + ["None"] = "literal", + ["True"] = "literal", + ["False"] = "literal", + } +} |
