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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
local syntax = require "core.syntax"
syntax.add {
files = { "%.php$", "%.phtml" },
comment = "//",
patterns = {
{ pattern = "//.-\n", type = "comment" },
{ pattern = { "/%*", "%*/" }, type = "comment" },
-- I dont know why the '//' are needed but I leave it here for now
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = { "'", "'", '\\' }, type = "string" },
{ pattern = "%\\x[%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" },
-- To indicate variables.
{ pattern = "%$", type = "operator" },
},
symbols = {
["return"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["elseif"] = "keyword",
["endif"] = "keyword",
["declare"] = "keyword",
["enddeclare"] = "keyword",
["switch"] = "keyword",
["endswitch"] = "keyword",
["as"] = "keyword",
["do"] = "keyword",
["for"] = "keyword",
["endfor"] = "keyword",
["foreach"] = "keyword",
["endforeach"] = "keyword",
["while"] = "keyword",
["endwhile"] = "keyword",
["switch"] = "keyword",
["case"] = "keyword",
["continue"] = "keyword",
["default"] = "keyword",
["break"] = "keyword",
["exit"] = "keyword",
["goto"] = "keyword",
["catch"] = "keyword",
["throw"] = "keyword",
["try"] = "keyword",
["finally"] = "keyword",
["class"] = "keyword",
["trait"] = "keyword",
["interface"] = "keyword",
["public"] = "keyword",
["static"] = "keyword",
["protected"] = "keyword",
["private"] = "keyword",
["abstract"] = "keyword",
["final"] = "keyword",
["function"] = "keyword2",
["global"] = "keyword2",
["var"] = "keyword2",
["const"] = "keyword2",
["bool"] = "keyword2",
["boolean"] = "keyword2",
["int"] = "keyword2",
["integer"] = "keyword2",
["real"] = "keyword2",
["double"] = "keyword2",
["float"] = "keyword2",
["string"] = "keyword2",
["array"] = "keyword2",
["object"] = "keyword2",
["callable"] = "keyword2",
["iterable"] = "keyword2",
["namespace"] = "keyword2",
["extends"] = "keyword2",
["implements"] = "keyword2",
["instanceof"] = "keyword2",
["require"] = "keyword2",
["require_once"] = "keyword2",
["include"] = "keyword2",
["include_once"] = "keyword2",
["use"] = "keyword2",
["new"] = "keyword2",
["clone"] = "keyword2",
["true"] = "literal",
["false"] = "literal",
["NULL"] = "literal",
["parent"] = "literal",
["self"] = "literal",
},
}
|