init: this is the inital commit
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
grammars/
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
expr = term { ( "+" | "-" ) term } ;
|
||||||
|
term = number { ( "*" | "/" ) number } ;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
id = "ebnf"
|
||||||
|
name = "EBNF"
|
||||||
|
version = "0.0.1"
|
||||||
|
schema_version = 1
|
||||||
|
authors = ["Jooris Hadeler <jooris@hadeler.me>"]
|
||||||
|
description = "Syntax highlighting for Extended Backus-Naur Form (EBNF)"
|
||||||
|
|
||||||
|
[grammars.ebnf]
|
||||||
|
repository = "https://git.hadeler.me/jooris/tree-sitter-ebnf"
|
||||||
|
commit = "main"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
version = "0.1.0"
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
; Standard brackets
|
||||||
|
("[" @open "]" @close)
|
||||||
|
("{" @open "}" @close)
|
||||||
|
("(" @open ")" @close)
|
||||||
|
|
||||||
|
; EBNF specific sequence brackets
|
||||||
|
("(/" @open "/)" @close)
|
||||||
|
("(:" @open ":)" @close)
|
||||||
|
|
||||||
|
; Strings
|
||||||
|
("\"" @open "\"" @close)
|
||||||
|
("'" @open "'" @close)
|
||||||
|
|
||||||
|
; Special sequence
|
||||||
|
("?" @open "?" @close)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
name = "EBNF"
|
||||||
|
grammar = "ebnf"
|
||||||
|
path_suffixes = ["ebnf"]
|
||||||
|
brackets = [
|
||||||
|
{ start = "{", end = "}", close = true, newline = true },
|
||||||
|
{ start = "[", end = "]", close = true, newline = true },
|
||||||
|
{ start = "(", end = ")", close = true, newline = false },
|
||||||
|
{ start = "(/", end = "/)", close = true, newline = false },
|
||||||
|
{ start = "(:", end = ":)", close = true, newline = false },
|
||||||
|
{ start = "\"", end = "\"", close = true, newline = false },
|
||||||
|
{ start = "'", end = "'", close = true, newline = false }
|
||||||
|
]
|
||||||
|
|
||||||
|
[language_server]
|
||||||
|
# Leave empty
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
; variables and identifiers
|
||||||
|
; We match the left-hand side of a rule as a function/type definition for better visual hierarchy
|
||||||
|
(syntax_rule
|
||||||
|
(meta_identifier) @type)
|
||||||
|
|
||||||
|
(meta_identifier) @property
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
(terminal_string) @string
|
||||||
|
(integer) @number
|
||||||
|
|
||||||
|
; Comments and special sequences
|
||||||
|
(comment) @comment
|
||||||
|
(special_sequence) @string.special
|
||||||
|
|
||||||
|
; Operators
|
||||||
|
"=" @operator
|
||||||
|
"|" @operator
|
||||||
|
"-" @operator
|
||||||
|
"*" @operator
|
||||||
|
|
||||||
|
; Delimiters
|
||||||
|
"," @punctuation.delimiter
|
||||||
|
";" @punctuation.delimiter
|
||||||
|
|
||||||
|
; Brackets
|
||||||
|
"[" @punctuation.bracket
|
||||||
|
"]" @punctuation.bracket
|
||||||
|
"{" @punctuation.bracket
|
||||||
|
"}" @punctuation.bracket
|
||||||
|
"(" @punctuation.bracket
|
||||||
|
")" @punctuation.bracket
|
||||||
|
"(/" @punctuation.bracket
|
||||||
|
"/)" @punctuation.bracket
|
||||||
|
"(:" @punctuation.bracket
|
||||||
|
":)" @punctuation.bracket
|
||||||
|
"?" @punctuation.bracket
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
(syntax_rule
|
||||||
|
(meta_identifier) @name
|
||||||
|
) @item
|
||||||
Reference in New Issue
Block a user