You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/design.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -22,22 +22,22 @@ In short:
22
22
23
23
## Important Definitions
24
24
25
-
- Parser: A dynamic library compiled from C source code that is generated by the Tree-sitter tool. A parser reads source code for a particular language and produces a syntax tree.
26
-
- Grammar: The rules that define how a parser will create the syntax tree for a language. The grammar is written in JavaScript. Tree-sitter tooling consumes the grammar as input and outputs C source (which can be compiled into a parser)
27
-
- Syntax Tree: a tree data structure comprised of syntax nodes that represents some source code text.
28
-
- Concrete Syntax Tree: Syntax trees that contain nodes for every token in the source code, including things likes brackets and parentheses. Tree-sitter creates Concrete Syntax Trees.
29
-
- Abstract Syntax Tree: A syntax tree with less important details removed. An AST may contain a node for a list, but not individual parentheses. Tree-sitter does not create Abstract Syntax Trees.
30
-
- Syntax Node: A node in a syntax tree. It represents some subset of a source code text. Each node has a type, defined by the grammar used to produce it. Some common node types represent language constructs like strings, integers, operators.
31
-
- Named Syntax Node: A node that can be identified by a name given to it in the Tree-sitter Grammar. In clojure-ts-mode, `list_lit` is a named node for lists.
32
-
- Anonymous Syntax Node: A node that cannot be identified by a name. In the Grammar these are identified by simple strings, not by complex Grammar rules. In clojure-ts-mode, `"("` and `")"` are anonymous nodes.
33
-
- Font Locking: What Emacs calls "Syntax Highlighting".
25
+
-**Parser**: A dynamic library compiled from C source code that is generated by the Tree-sitter tool. A parser reads source code for a particular language and produces a syntax tree.
26
+
-**Grammar**: The rules that define how a parser will create the syntax tree for a language. The grammar is written in JavaScript. Tree-sitter tooling consumes the grammar as input and outputs C source (which can be compiled into a parser)
27
+
-**Syntax Tree**: a tree data structure comprised of syntax nodes that represents some source code text.
28
+
-**Concrete Syntax Tree**: Syntax trees that contain nodes for every token in the source code, including things likes brackets and parentheses. Tree-sitter creates Concrete Syntax Trees.
29
+
-**Abstract Syntax Tree**: A syntax tree with less important details removed. An AST may contain a node for a list, but not individual parentheses. Tree-sitter does not create Abstract Syntax Trees.
30
+
-**Syntax Node**: A node in a syntax tree. It represents some subset of a source code text. Each node has a type, defined by the grammar used to produce it. Some common node types represent language constructs like strings, integers, operators.
31
+
-**Named Syntax Node**: A node that can be identified by a name given to it in the Tree-sitter Grammar. In clojure-ts-mode, `list_lit` is a named node for lists.
32
+
-**Anonymous Syntax Node**: A node that cannot be identified by a name. In the Grammar these are identified by simple strings, not by complex Grammar rules. In clojure-ts-mode, `"("` and `")"` are anonymous nodes.
33
+
-**Font Locking**: The Emacs terminology for "syntax highlighting".
34
34
35
35
## tree-sitter-clojure
36
36
37
37
`clojure-ts-mode` uses the experimental version tree-sitter-clojure grammar, which
38
38
can be found at
39
39
<https://github.com/sogaiu/tree-sitter-clojure/tree/unstable-20250526>. The
40
-
`clojure-ts-mode`grammar provides very basic, low level nodes that try to match
40
+
grammar provides very basic, low level nodes that try to match
41
41
Clojure's very light syntax.
42
42
43
43
There are nodes to represent:
@@ -86,8 +86,8 @@ will produce a parse tree like so
86
86
```
87
87
88
88
Although it's somewhat closer to how Clojure treats metadata itself, in the
89
-
context of a text editor it creates some problems, which were discussed[here](https://github.com/sogaiu/tree-sitter-clojure/issues/65). To
90
-
name a few:
89
+
context of a text editor it creates some problems, which were discussed
90
+
[here](https://github.com/sogaiu/tree-sitter-clojure/issues/65). To name a few:
91
91
92
92
-`forward-sexp` command would skip both, metadata and the node it's attached
93
93
to. Called from an opening paren it would signal an error "No more sexp to
0 commit comments