aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit/syntax_rules/python.syntax
blob: 6690d98c37215a4c1a9e56609f5d678353a59c4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Syntax support file for the Lumina Text Editor
# ===================================
#  Python language support rules
#  Written by Ken Moore <ken@ixsystems.com>
#  Released under the 2-clause BSD license
# ===================================

{
	"meta": {
		"name": "Python",
		"file_suffix": ["py", "pyc"]
	},
	"format": {
		"line_wrap": false,
		"highlight_whitespace_eol": true
	},
	"rules": [{
			"name": "single-line comment",
			"regex": "#[^\n]*",
			"foreground": "colors/comment"
		},
		{
			"name": "keywords",
			"words": ["and" , "as" , "assert" , "break" , "class" , "continue" , "def" , "del" , "elif" , "else" , "except" , "exec" , "finally" , "for" , "from" , "global" , "if" , "import" , "in" , "is" , "lambda" , "not" , "or" , "pass" , "print" , "raise" , "return" , "try" , "while" , "with" , "yield"],
			"foreground": "colors/keyword",
			"font_weight": "bold"
		},
		{
			"name": "class names",
			"regex": "\\bQ[A-Za-z]+\\b",
			"foreground": "colors/class",
			"font_weight": "bold"
		},
		{
			"name": "function names",
			"regex": "\\b[A-Za-z0-9_]+(?=\\()",
			"foreground": "colors/function"
		},
		{
			"name": "numbers",
			"regex" : "\\b[0-9]+\\.?[0-9]*\\b",
			"foreground": "colors/altkeyword"
		},
		{
			"name": "text",
			"regex":  "\"[^\"\\\\]*(\\\\(.|\\n)[^\"\\\\]*)*\"|'[^'\\\\]*(\\\\(.|\\n)[^'\\\\]*)*'",
			"foreground": "colors/text"
		},
		{
			"name": "preprocessor",
			"regex": "^[\\s]*#[^\n]*",
			"foreground": "colors/preprocessor"
		}
	]
}
bgstack15