From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Writing manuals
Date: Fri, 3 Sep 2021 22:35:40 -0700 [thread overview]
Message-ID: <DAFD6A80-BE15-4B32-B729-572AB33447AE@gmail.com> (raw)
In-Reply-To: <83k0kh1j84.fsf@gnu.org>
Here is the first page/node of tree-sitter’s manual, do you think the third paragraph is redundant? It basically connects each menu items together, but it also feels like just repeating the menu. And, IIUC nodes are uniquely named in a manual, I think maybe it’s not a good idea to use generic node names like “Language Definition”, “Pattern Matching”, etc, any suggestions?
The tree-sitter library
(@uref{https://tree-sitter.github.io/tree-sitter/}) implements an
incremental parser that supports a wide range of programming
languages. A tree-sitter parser can generate and update a
@dfn{concrete syntax tree}. In a syntax tree, text is no longer a
one-dimensional stream but a structured tree of nodes, where each node
representing a piece of text. Thus a syntax tree can enable
interesting features like precise fontification and indentation,
structured editing, etc.
Apart from tree-sitter, Emacs provides a simple parsing facility for
parsing balanced expressions. @xref{Parsing Expressions}.
TODO: redundant?
To access the syntax tree of the text in a buffer, we need to first
load a language definition and create a parser with it. Next, we can
query the parser for specific nodes in the syntax tree. Then, we can
access various information about the node. Finally, we can
pattern-match a node with a powerful syntax. The following sections
explain how to do each of the tasks in detail. The last section
compares the differences between tree-sitter's C API and the functions
provided by Emacs Lisp, and the correspondence between all
tree-sitter's C functions and their Emacs Lisp counterparts.
@menu
* Language Definitions:: Loading tree-sitter language definitions.
* Using Parser:: Introduction to parsers.
* Retrieving Node:: Retrieving node from syntax tree.
* Accessing Node:: Accessing node information.
* Pattern Matching:: Pattern matching with query patterns.
* Multiple Languages:: Parse text written in multiple languages.
* Tree-sitter C API:: A map from the C API to the ELisp API.
@end menu
Yuan
next prev parent reply other threads:[~2021-09-04 5:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 6:42 Writing manuals Yuan Fu
2021-08-17 11:37 ` Eli Zaretskii
2021-08-17 16:28 ` Yuan Fu
2021-08-17 17:20 ` Eli Zaretskii
2021-08-17 18:10 ` Yuan Fu
2021-08-17 18:35 ` Eli Zaretskii
2021-08-17 20:08 ` Yuan Fu
2021-08-18 2:26 ` Eli Zaretskii
2021-08-18 3:24 ` Yuan Fu
2021-08-18 12:31 ` Eli Zaretskii
2021-08-19 2:35 ` Richard Stallman
2021-08-19 6:53 ` Eli Zaretskii
2021-08-19 15:59 ` Yuan Fu
2021-08-19 16:10 ` Eli Zaretskii
2021-08-19 16:29 ` Fu Yuan
2021-08-19 16:40 ` Eli Zaretskii
2021-09-04 5:35 ` Yuan Fu [this message]
2021-09-04 7:33 ` Eli Zaretskii
2021-09-04 15:48 ` Yuan Fu
2021-09-04 15:54 ` Eli Zaretskii
[not found] ` <CAJnXXoiTw_soZiBi48mJ-kKH-wWktq0EU+kJy4-bbsYZgeB=7A@mail.gmail.com>
2021-09-05 20:02 ` Yuan Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DAFD6A80-BE15-4B32-B729-572AB33447AE@gmail.com \
--to=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).