aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/lua-mode-resources/font-lock.lua
blob: bcf77b632c21bee3e8223012905192f09b3b9eaf (plain) (blame)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/usr/bin/env lua
-- ^ font-lock-comment-face
-- Comment
-- <- font-lock-comment-delimiter-face
-- ^ font-lock-comment-face
--[[
-- ^ font-lock-comment-face
Multi-line comment
-- ^ font-lock-comment-face
]]
-- <- font-lock-comment-face
local line_comment = "comment" -- comment
--                                ^ font-lock-comment-face

-- Definition
local function f1() end
--             ^ font-lock-function-name-face
local f2 = function() end
--    ^ font-lock-function-name-face
local tb = { f1 = function() end }
--           ^ font-lock-function-name-face
function tb.f2() end
--          ^ font-lock-function-name-face
function tb:f3() end
--          ^ font-lock-function-name-face
tbl.f4 = function() end
--  ^ font-lock-function-name-face
function x.y:z() end
--           ^ font-lock-function-name-face

-- Keyword
if true then
-- <- font-lock-keyword-face
--      ^ font-lock-keyword-face
elseif true then
-- <- font-lock-keyword-face
else end
-- <- font-lock-keyword-face
--   ^ font-lock-keyword-face
local p = {}
-- ^ font-lock-keyword-face
for k,v in pairs({}) do end
-- <- font-lock-keyword-face
--      ^ font-lock-keyword-face
repeat if true then break end until false
-- <- font-lock-keyword-face
--                  ^ font-lock-keyword-face
--                            ^ font-lock-keyword-face
while true do end
-- <- font-lock-keyword-face
--         ^ font-lock-keyword-face
function fn() return true end
-- <- font-lock-keyword-face
--            ^ font-lock-keyword-face
goto label1
-- ^ font-lock-keyword-face
::label1::
if true and not false or nil then
--      ^ font-lock-keyword-face
--          ^ font-lock-keyword-face
--                    ^ font-lock-keyword-face
end

-- String
local _
_ = "x"
--   ^ font-lock-string-face
_ = 'x'
--   ^ font-lock-string-face
_ = "x\ty"
--   ^ font-lock-string-face
--      ^ font-lock-string-face
_ = "x\"y"
--   ^ font-lock-string-face
--      ^ font-lock-string-face
_ = 'x\'y'
--   ^ font-lock-string-face
--      ^ font-lock-string-face
_ = "x\z
    y"
--  ^ font-lock-string-face
_ = "x\0900y"
--        ^ font-lock-string-face
_ = "x\09y"
--       ^ font-lock-string-face
_ = "x\0y"
--      ^ font-lock-string-face
_ = "x\u{1f602}y"
--             ^ font-lock-string-face
_ = [[x]]
--    ^ font-lock-string-face
_ = [=[x]=]
--     ^ font-lock-string-face

-- Assignment
local n = 0
--    ^ font-lock-variable-name-face
for i=0,9 do end
--  ^ font-lock-variable-name-face

-- Constant
::label2::
-- ^ font-lock-constant-face
goto label2
--   ^ font-lock-constant-face

-- Builtin
assert()
-- <- font-lock-builtin-face
bit32()
-- <- font-lock-builtin-face
collectgarbage()
-- <- font-lock-builtin-face
coroutine()
-- <- font-lock-builtin-face
debug()
-- <- font-lock-builtin-face
dofile()
-- <- font-lock-builtin-face
error()
-- <- font-lock-builtin-face
getmetatable()
-- <- font-lock-builtin-face
io()
-- <- font-lock-builtin-face
ipairs()
-- <- font-lock-builtin-face
load()
-- <- font-lock-builtin-face
loadfile()
-- <- font-lock-builtin-face
math()
-- <- font-lock-builtin-face
next()
-- <- font-lock-builtin-face
os()
-- <- font-lock-builtin-face
package()
-- <- font-lock-builtin-face
pairs()
-- <- font-lock-builtin-face
pcall()
-- <- font-lock-builtin-face
print()
-- <- font-lock-builtin-face
rawequal()
-- <- font-lock-builtin-face
rawget()
-- <- font-lock-builtin-face
rawlen()
-- <- font-lock-builtin-face
rawset()
-- <- font-lock-builtin-face
require()
-- <- font-lock-builtin-face
select()
-- <- font-lock-builtin-face
setmetatable()
-- <- font-lock-builtin-face
string()
-- <- font-lock-builtin-face
table()
-- <- font-lock-builtin-face
tonumber()
-- <- font-lock-builtin-face
tostring()
-- <- font-lock-builtin-face
type()
-- <- font-lock-builtin-face
utf8()
-- <- font-lock-builtin-face
warn()
-- <- font-lock-builtin-face
xpcall()
-- <- font-lock-builtin-face
print(_G)
--    ^ font-lock-builtin-face
print(_VERSION)
--    ^ font-lock-builtin-face

-- Variable
function fn(x, y) end
--          ^ font-lock-variable-name-face
--             ^ font-lock-variable-name-face