mirror of https://github.com/Wilfred/difftastic/
Add lua support
parent
02fd04189c
commit
b850d41fa5
@ -0,0 +1,16 @@
|
|||||||
|
function test(name)
|
||||||
|
print("testing"..name)
|
||||||
|
return 10
|
||||||
|
end
|
||||||
|
|
||||||
|
if test("myname") == 20 then
|
||||||
|
print("20")
|
||||||
|
end
|
||||||
|
|
||||||
|
local list = { "A", "B", "C", "D" }
|
||||||
|
local table = { a = "A", b = "B", c = "C", d = "D" }
|
||||||
|
|
||||||
|
for k, v in pairs(table) do
|
||||||
|
print("k: "..k.." v: "..v)
|
||||||
|
end
|
||||||
|
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
function test()
|
||||||
|
print("testing")
|
||||||
|
return 10
|
||||||
|
end
|
||||||
|
|
||||||
|
if test() == 20 then
|
||||||
|
print("30")
|
||||||
|
end
|
||||||
|
|
||||||
|
local list = { "A", "B", "D" }
|
||||||
|
local table = { a = "A", b = "B", d = "D" }
|
||||||
|
|
||||||
|
for k, v in pairs(table) do
|
||||||
|
print("k: "..k.." v: "..v)
|
||||||
|
end
|
||||||
|
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
;; Keywords
|
||||||
|
|
||||||
|
[
|
||||||
|
"goto"
|
||||||
|
"in"
|
||||||
|
"local"
|
||||||
|
"return"
|
||||||
|
"and"
|
||||||
|
"not"
|
||||||
|
"or"
|
||||||
|
"function"
|
||||||
|
"if"
|
||||||
|
"elseif"
|
||||||
|
"else"
|
||||||
|
"then"
|
||||||
|
"for"
|
||||||
|
"do"
|
||||||
|
"end"
|
||||||
|
"repeat"
|
||||||
|
"until"
|
||||||
|
"while"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"+"
|
||||||
|
"-"
|
||||||
|
"*"
|
||||||
|
"/"
|
||||||
|
"%"
|
||||||
|
"^"
|
||||||
|
"#"
|
||||||
|
"=="
|
||||||
|
"~="
|
||||||
|
"<="
|
||||||
|
">="
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
"="
|
||||||
|
"&"
|
||||||
|
"~"
|
||||||
|
"|"
|
||||||
|
"<<"
|
||||||
|
">>"
|
||||||
|
"//"
|
||||||
|
".."
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
;; Variables
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
((identifier) @variable.builtin
|
||||||
|
(#match? @variable.builtin "self"))
|
||||||
|
|
||||||
|
;; Constants
|
||||||
|
|
||||||
|
((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
|
(nil) @constant.builtin
|
||||||
|
|
||||||
|
[
|
||||||
|
(false)
|
||||||
|
(true)
|
||||||
|
] @boolean
|
||||||
|
|
||||||
|
;; Others
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
(number) @number
|
||||||
|
|
||||||
|
(string) @string
|
||||||
|
|
||||||
|
;; Error
|
||||||
|
(ERROR) @error
|
||||||
@ -0,0 +1 @@
|
|||||||
|
tree-sitter-lua/src/
|
||||||
Loading…
Reference in New Issue