mirror of
https://github.com/HiPhish/rainbow-delimiters.nvim.git
synced 2024-09-08 02:25:48 +02:00
Add Awk support
This commit is contained in:
parent
5e00781455
commit
960cce4eba
4 changed files with 429 additions and 0 deletions
|
@ -15,6 +15,8 @@ Unreleased
|
|||
Added
|
||||
=====
|
||||
|
||||
- Awk support
|
||||
|
||||
- Recipes section in the manual
|
||||
|
||||
- Django HTML support (preliminary, will only pass through injected languages)
|
||||
|
|
48
queries/awk/rainbow-delimiters.scm
Normal file
48
queries/awk/rainbow-delimiters.scm
Normal file
|
@ -0,0 +1,48 @@
|
|||
(block
|
||||
"{" @delimiter
|
||||
"}" @delimiter @sentinel) @container
|
||||
|
||||
(grouping
|
||||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
|
||||
(array_ref
|
||||
"[" @delimiter
|
||||
"]" @delimiter @sentinel) @container
|
||||
|
||||
(func_call
|
||||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
|
||||
(if_statement
|
||||
"if"
|
||||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
|
||||
(while_statement
|
||||
"while"
|
||||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
|
||||
;; This messes up the highlighting of the sibling block
|
||||
; (do_while_statement
|
||||
; "(" @delimiter
|
||||
; ")" @delimiter @sentinel) @container
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
|
||||
(for_in_statement
|
||||
"for"
|
||||
"(" @delimiter
|
||||
")" @delimiter @sentinel) @container
|
||||
|
||||
(switch_statement
|
||||
"switch"
|
||||
"(" @delimiter
|
||||
")" @delimiter
|
||||
(switch_body
|
||||
"{" @delimiter
|
||||
"}" @delimiter @sentinel)) @container
|
39
test/highlight/samples/awk/regular.awk
Normal file
39
test/highlight/samples/awk/regular.awk
Normal file
|
@ -0,0 +1,39 @@
|
|||
BEGIN {
|
||||
print "Hello world"
|
||||
}
|
||||
|
||||
/(foo | (bar | baz))/ {
|
||||
print "One of foo, bar or baz"
|
||||
print (1 + (2 + (3 + 4)))
|
||||
print foo[bar[baz[herp[derp]]]]
|
||||
print foo(bar(baz(herp(derp))))
|
||||
if (false) {
|
||||
if (false) {
|
||||
if (false) {
|
||||
print "This never happens"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (false) {
|
||||
do {
|
||||
for (i = 1; i < 5; i++) {
|
||||
print "This never happens"
|
||||
}
|
||||
for (var in array) {
|
||||
print "This never happens"
|
||||
}
|
||||
} while (false)
|
||||
}
|
||||
|
||||
switch (expr) {
|
||||
case 1:
|
||||
print "One"
|
||||
break
|
||||
case 2:
|
||||
print "Two"
|
||||
break
|
||||
default:
|
||||
print "Something else"
|
||||
}
|
||||
}
|
340
test/highlight/spec/awk/rainbow-delimiters/regular.awk.lua
Normal file
340
test/highlight/spec/awk/rainbow-delimiters/regular.awk.lua
Normal file
|
@ -0,0 +1,340 @@
|
|||
return {
|
||||
awk = { {
|
||||
end_col = 7,
|
||||
end_row = 7,
|
||||
hl_group = "RainbowDelimiterRed",
|
||||
start_col = 6,
|
||||
start_row = 0
|
||||
}, {
|
||||
end_col = 1,
|
||||
end_row = 1,
|
||||
hl_group = "RainbowDelimiterRed",
|
||||
start_col = 0,
|
||||
start_row = 2
|
||||
}, {
|
||||
end_col = 23,
|
||||
end_row = 23,
|
||||
hl_group = "RainbowDelimiterRed",
|
||||
start_col = 22,
|
||||
start_row = 4
|
||||
}, {
|
||||
end_col = 8,
|
||||
end_row = 8,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 7,
|
||||
start_row = 6
|
||||
}, {
|
||||
end_col = 13,
|
||||
end_row = 13,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 12,
|
||||
start_row = 6
|
||||
}, {
|
||||
end_col = 18,
|
||||
end_row = 18,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 17,
|
||||
start_row = 6
|
||||
}, {
|
||||
end_col = 24,
|
||||
end_row = 24,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 23,
|
||||
start_row = 6
|
||||
}, {
|
||||
end_col = 25,
|
||||
end_row = 25,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 24,
|
||||
start_row = 6
|
||||
}, {
|
||||
end_col = 26,
|
||||
end_row = 26,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 25,
|
||||
start_row = 6
|
||||
}, {
|
||||
end_col = 11,
|
||||
end_row = 11,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 10,
|
||||
start_row = 7
|
||||
}, {
|
||||
end_col = 15,
|
||||
end_row = 15,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 14,
|
||||
start_row = 7
|
||||
}, {
|
||||
end_col = 19,
|
||||
end_row = 19,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 18,
|
||||
start_row = 7
|
||||
}, {
|
||||
end_col = 24,
|
||||
end_row = 24,
|
||||
hl_group = "RainbowDelimiterGreen",
|
||||
start_col = 23,
|
||||
start_row = 7
|
||||
}, {
|
||||
end_col = 29,
|
||||
end_row = 29,
|
||||
hl_group = "RainbowDelimiterGreen",
|
||||
start_col = 28,
|
||||
start_row = 7
|
||||
}, {
|
||||
end_col = 30,
|
||||
end_row = 30,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 29,
|
||||
start_row = 7
|
||||
}, {
|
||||
end_col = 31,
|
||||
end_row = 31,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 30,
|
||||
start_row = 7
|
||||
}, {
|
||||
end_col = 32,
|
||||
end_row = 32,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 31,
|
||||
start_row = 7
|
||||
}, {
|
||||
end_col = 11,
|
||||
end_row = 11,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 10,
|
||||
start_row = 8
|
||||
}, {
|
||||
end_col = 15,
|
||||
end_row = 15,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 14,
|
||||
start_row = 8
|
||||
}, {
|
||||
end_col = 19,
|
||||
end_row = 19,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 18,
|
||||
start_row = 8
|
||||
}, {
|
||||
end_col = 24,
|
||||
end_row = 24,
|
||||
hl_group = "RainbowDelimiterGreen",
|
||||
start_col = 23,
|
||||
start_row = 8
|
||||
}, {
|
||||
end_col = 29,
|
||||
end_row = 29,
|
||||
hl_group = "RainbowDelimiterGreen",
|
||||
start_col = 28,
|
||||
start_row = 8
|
||||
}, {
|
||||
end_col = 30,
|
||||
end_row = 30,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 29,
|
||||
start_row = 8
|
||||
}, {
|
||||
end_col = 31,
|
||||
end_row = 31,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 30,
|
||||
start_row = 8
|
||||
}, {
|
||||
end_col = 32,
|
||||
end_row = 32,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 31,
|
||||
start_row = 8
|
||||
}, {
|
||||
end_col = 5,
|
||||
end_row = 5,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 4,
|
||||
start_row = 9
|
||||
}, {
|
||||
end_col = 11,
|
||||
end_row = 11,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 10,
|
||||
start_row = 9
|
||||
}, {
|
||||
end_col = 13,
|
||||
end_row = 13,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 12,
|
||||
start_row = 9
|
||||
}, {
|
||||
end_col = 6,
|
||||
end_row = 6,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 5,
|
||||
start_row = 10
|
||||
}, {
|
||||
end_col = 12,
|
||||
end_row = 12,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 11,
|
||||
start_row = 10
|
||||
}, {
|
||||
end_col = 14,
|
||||
end_row = 14,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 13,
|
||||
start_row = 10
|
||||
}, {
|
||||
end_col = 7,
|
||||
end_row = 7,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 6,
|
||||
start_row = 11
|
||||
}, {
|
||||
end_col = 13,
|
||||
end_row = 13,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 12,
|
||||
start_row = 11
|
||||
}, {
|
||||
end_col = 15,
|
||||
end_row = 15,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 14,
|
||||
start_row = 11
|
||||
}, {
|
||||
end_col = 4,
|
||||
end_row = 4,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 3,
|
||||
start_row = 13
|
||||
}, {
|
||||
end_col = 3,
|
||||
end_row = 3,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 2,
|
||||
start_row = 14
|
||||
}, {
|
||||
end_col = 2,
|
||||
end_row = 2,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 1,
|
||||
start_row = 15
|
||||
}, {
|
||||
end_col = 8,
|
||||
end_row = 8,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 7,
|
||||
start_row = 17
|
||||
}, {
|
||||
end_col = 14,
|
||||
end_row = 14,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 13,
|
||||
start_row = 17
|
||||
}, {
|
||||
end_col = 16,
|
||||
end_row = 16,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 15,
|
||||
start_row = 17
|
||||
}, {
|
||||
end_col = 6,
|
||||
end_row = 6,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 5,
|
||||
start_row = 18
|
||||
}, {
|
||||
end_col = 8,
|
||||
end_row = 8,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 7,
|
||||
start_row = 19
|
||||
}, {
|
||||
end_col = 26,
|
||||
end_row = 26,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 25,
|
||||
start_row = 19
|
||||
}, {
|
||||
end_col = 28,
|
||||
end_row = 28,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 27,
|
||||
start_row = 19
|
||||
}, {
|
||||
end_col = 4,
|
||||
end_row = 4,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 3,
|
||||
start_row = 21
|
||||
}, {
|
||||
end_col = 8,
|
||||
end_row = 8,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 7,
|
||||
start_row = 22
|
||||
}, {
|
||||
end_col = 21,
|
||||
end_row = 21,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 20,
|
||||
start_row = 22
|
||||
}, {
|
||||
end_col = 23,
|
||||
end_row = 23,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 22,
|
||||
start_row = 22
|
||||
}, {
|
||||
end_col = 4,
|
||||
end_row = 4,
|
||||
hl_group = "RainbowDelimiterOrange",
|
||||
start_col = 3,
|
||||
start_row = 24
|
||||
}, {
|
||||
end_col = 3,
|
||||
end_row = 3,
|
||||
hl_group = "RainbowDelimiterBlue",
|
||||
start_col = 2,
|
||||
start_row = 25
|
||||
}, {
|
||||
end_col = 2,
|
||||
end_row = 2,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 1,
|
||||
start_row = 26
|
||||
}, {
|
||||
end_col = 9,
|
||||
end_row = 9,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 8,
|
||||
start_row = 28
|
||||
}, {
|
||||
end_col = 14,
|
||||
end_row = 14,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 13,
|
||||
start_row = 28
|
||||
}, {
|
||||
end_col = 16,
|
||||
end_row = 16,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 15,
|
||||
start_row = 28
|
||||
}, {
|
||||
end_col = 2,
|
||||
end_row = 2,
|
||||
hl_group = "RainbowDelimiterYellow",
|
||||
start_col = 1,
|
||||
start_row = 37
|
||||
}, {
|
||||
end_col = 1,
|
||||
end_row = 1,
|
||||
hl_group = "RainbowDelimiterRed",
|
||||
start_col = 0,
|
||||
start_row = 38
|
||||
} },
|
||||
regex = {}
|
||||
}
|
Loading…
Reference in a new issue