mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
Add ebnf parser
This commit is contained in:
parent
cffe9c28b8
commit
41a59591a5
2 changed files with 54 additions and 0 deletions
|
|
@ -1331,6 +1331,17 @@ list.mermaid = {
|
||||||
experimental = true,
|
experimental = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.ebnf = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/RubixDev/ebnf.git",
|
||||||
|
files = { "src/parser.c" },
|
||||||
|
location = "crates/tree-sitter-ebnf",
|
||||||
|
branch = "main",
|
||||||
|
},
|
||||||
|
maintainers = { "@RubixDev" },
|
||||||
|
experimental = true,
|
||||||
|
}
|
||||||
|
|
||||||
local M = {
|
local M = {
|
||||||
list = list,
|
list = list,
|
||||||
filetype_to_parsername = filetype_to_parsername,
|
filetype_to_parsername = filetype_to_parsername,
|
||||||
|
|
|
||||||
43
queries/ebnf/highlights.scm
Normal file
43
queries/ebnf/highlights.scm
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
;;;; Simple tokens ;;;;
|
||||||
|
(terminal) @string.grammar
|
||||||
|
|
||||||
|
(special_sequence) @string.special.grammar
|
||||||
|
|
||||||
|
(integer) @number
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
;;;; Identifiers ;;;;
|
||||||
|
|
||||||
|
; Allow different highlighting for specific casings
|
||||||
|
((identifier) @type
|
||||||
|
(#match? @type "^[A-Z]"))
|
||||||
|
|
||||||
|
((identifier) @symbol
|
||||||
|
(#match? @symbol "^[a-z]"))
|
||||||
|
|
||||||
|
((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||||
|
|
||||||
|
;;; Punctuation ;;;;
|
||||||
|
[
|
||||||
|
";"
|
||||||
|
","
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"|"
|
||||||
|
"*"
|
||||||
|
"-"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
"=" @keyword.operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
Loading…
Add table
Add a link
Reference in a new issue