-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(languages): Lean experimental tree-sitter-lean (#1422)
* Add experimental tree-sitter-lean * Run docgen * Copy over the queries from lean.nvim * Update .gitmodules Co-authored-by: Ivan Tham <[email protected]> * Update lean highlights and run docgen * Update runtime/queries/lean/injections.scm Co-authored-by: Michael Davis <[email protected]> * Lean: Move variable matcher to bottom * Update runtime/queries/lean/locals.scm Co-authored-by: Michael Davis <[email protected]> Co-authored-by: Ivan Tham <[email protected]> Co-authored-by: Michael Davis <[email protected]>
- Loading branch information
1 parent
e7eab95
commit 8ea5742
Showing
8 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule tree-sitter-lean
added at
d98426
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ | ||
(namespace) | ||
(section) | ||
|
||
(instance) | ||
(def) | ||
(theorem) | ||
(example) | ||
|
||
(product) | ||
(array) | ||
(list) | ||
|
||
(string) | ||
] @fold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
(open | ||
namespace: (identifier) @namespace) | ||
(namespace | ||
name: (identifier) @namespace) | ||
(section | ||
name: (identifier) @namespace) | ||
|
||
;; Identifier naming conventions | ||
((identifier) @type | ||
(#match? @type "^[A-Z]")) | ||
|
||
(arrow) @type | ||
(product) @type | ||
|
||
;; Declarations | ||
|
||
[ | ||
"abbrev" | ||
"def" | ||
"theorem" | ||
"constant" | ||
"instance" | ||
"axiom" | ||
"example" | ||
"inductive" | ||
"structure" | ||
"class" | ||
|
||
"deriving" | ||
|
||
"section" | ||
"namespace" | ||
] @keyword | ||
|
||
(attributes | ||
(identifier) @function) | ||
|
||
(abbrev | ||
name: (identifier) @type) | ||
(def | ||
name: (identifier) @function) | ||
(theorem | ||
name: (identifier) @function) | ||
(constant | ||
name: (identifier) @type) | ||
(instance | ||
name: (identifier) @function) | ||
(instance | ||
type: (identifier) @type) | ||
(axiom | ||
name: (identifier) @function) | ||
(structure | ||
name: (identifier) @type) | ||
(structure | ||
extends: (identifier) @type) | ||
|
||
(where_decl | ||
type: (identifier) @type) | ||
|
||
(proj | ||
name: (identifier) @field) | ||
|
||
(binders | ||
type: (identifier) @type) | ||
|
||
["if" "then" "else"] @keyword.control.conditional | ||
|
||
["for" "in" "do"] @keyword.control.repeat | ||
|
||
(import) @include | ||
|
||
; Tokens | ||
|
||
[ | ||
"!" | ||
"$" | ||
"%" | ||
"&&" | ||
"*" | ||
"*>" | ||
"+" | ||
"++" | ||
"-" | ||
"/" | ||
"::" | ||
":=" | ||
"<" | ||
"<$>" | ||
"<*" | ||
"<*>" | ||
"<=" | ||
"<|" | ||
"<|>" | ||
"=" | ||
"==" | ||
"=>" | ||
">" | ||
">" | ||
">=" | ||
">>" | ||
">>=" | ||
"@" | ||
"^" | ||
"|>" | ||
"|>." | ||
"||" | ||
"←" | ||
"→" | ||
"↔" | ||
"∘" | ||
"∧" | ||
"∨" | ||
"≠" | ||
"≤" | ||
"≥" | ||
] @operator | ||
|
||
[ | ||
"@&" | ||
] @operator | ||
|
||
[ | ||
"attribute" | ||
"by" | ||
"end" | ||
"export" | ||
"extends" | ||
"fun" | ||
"let" | ||
"have" | ||
"match" | ||
"open" | ||
"return" | ||
"universe" | ||
"variable" | ||
"where" | ||
"with" | ||
"λ" | ||
(hash_command) | ||
(prelude) | ||
(sorry) | ||
] @keyword | ||
|
||
[ | ||
"prefix" | ||
"infix" | ||
"infixl" | ||
"infixr" | ||
"postfix" | ||
"notation" | ||
"macro_rules" | ||
"syntax" | ||
"elab" | ||
"builtin_initialize" | ||
] @keyword | ||
|
||
[ | ||
"noncomputable" | ||
"partial" | ||
"private" | ||
"protected" | ||
"unsafe" | ||
] @keyword | ||
|
||
[ | ||
"apply" | ||
"exact" | ||
"rewrite" | ||
"rw" | ||
"simp" | ||
(trivial) | ||
] @keyword | ||
|
||
[ | ||
"catch" | ||
"finally" | ||
"try" | ||
] @exception | ||
|
||
((apply | ||
name: (identifier) @exception) | ||
(#match? @exception "throw")) | ||
|
||
[ | ||
"unless" | ||
"mut" | ||
] @keyword | ||
|
||
[(true) (false)] @boolean | ||
|
||
(number) @constant.numeric.integer | ||
(float) @constant.numeric.float | ||
|
||
(comment) @comment | ||
(char) @character | ||
(string) @string | ||
(interpolated_string) @string | ||
; (escape_sequence) @string.escape | ||
|
||
; Reset highlighing in string interpolation | ||
(interpolation) @none | ||
|
||
(interpolation | ||
"{" @punctuation.special | ||
"}" @punctuation.special) | ||
|
||
["(" ")" "[" "]" "{" "}" "⟨" "⟩"] @punctuation.bracket | ||
|
||
["|" "," "." ":" ";"] @punctuation.delimiter | ||
|
||
(sorry) @error | ||
|
||
;; Error | ||
(ERROR) @error | ||
|
||
; Variables | ||
(identifier) @variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
((comment) @injection.content | ||
(#set! injection.language "markdown")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
(module) | ||
(namespace) | ||
(section) | ||
] @local.scope |