-
Notifications
You must be signed in to change notification settings - Fork 2
Glossary
This project uses corpus files as a form of documentation and testing. Usually these files will live next to their counterpart source files under a corpus directory.
The structure of the corpus files is as follows:
- H1 headers denote the function under test e.g.
# TypeScript Forward Slurp
- H2 headers describe groups of tests (test blocks) e.g.
# TypeScript Forward Slurp
## Empty Array
- Code block pairs denote the input and expected outputs. The first code block in the pair is the input source, and the second code block is the expected output source with the function applied e.g.
- Multiple code block pairs may be under one H2
Nodes are parsed groupings of data. To give an example, the following HTML <div></div>
may be parsed as (element (start_tag) (end_tag))
. Each one of those pairs of parens represents a node. Tree-sitter produces a tree of nodes when it parses data. Tree-sitter nodes contain additional helpful information like access to start/end indices, prev/next siblings, a list of immediate child nodes, etc.
An object is a node that can be acted on. For example, HTML text nodes are object nodes that can be slurped/barfed/raised, but they cannot slurp/barf/raise other nodes. Not all nodes are object nodes.
The below examples are not necessarily all of the different kinds of object nodes -there are lots!
- comments
- doctype declarations
- elements
- non-empty texts
- scripts
- styles
- all expressions
- function declarations
- labeled statements
- statement blocks
- variable declarations
Par Edit, also commonly referred to as paredit, is a concept of editing code utilized by editors/extensions that support Lisp and Lisp dialects like Clojure/ClojureScript.
To understand it better, it may be helpful for one to first understand the very basics of the core building blocks of Lisps, S-expressions.
Here's an S-expression that adds two numbers (+ 1 2)
. To folks who've never seen Lisps before, the aformentioned S-expression may look understandably odd.
Paredit is a structural editing technique that focuses on keeping parenthesis balanced as one codes. Implementors of paredit also often offer users a versatile suite of editing keys/commands that allow for quick code manipulation.
Owlbear aims to bring some of these goodies from paredit to the more mainstream worlds of HTML, JS/X, TS/X, etc. where applicable!
The docs for the Calva (Clojure) VS Code extension explains paredit quite well, with examples! https://calva.io/paredit/
A subject is a node that is capable of performing an action on other nodes. For example, HTML elements are subject nodes that can slurp/barf/raise other nodes. Most subject nodes are also object nodes.
The below examples are not necessarily all of the different kinds of subject nodes!
- comments
- non-self-closing elements
- arrays
- JSX elements/fragments
- JSX expressions e.g.
{}
in JSX - JSX arguments e.g. the
()
infoo()
- JS objects
- parenthesized expressions
- statement blocks e.g. function, interface, type bodies
- strings
- template string substitutions e.g.
${}