[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/parseclj da4bacb5f5 078/185: Rename parseclj-reduce to par
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/parseclj da4bacb5f5 078/185: Rename parseclj-reduce to parseclj-parse |
Date: |
Tue, 28 Dec 2021 14:05:20 -0500 (EST) |
branch: elpa/parseclj
commit da4bacb5f5d74b914f853450539ddf5a4bb06642
Author: Arne Brasseur <arne@arnebrasseur.net>
Commit: Arne Brasseur <arne@arnebrasseur.net>
Rename parseclj-reduce to parseclj-parse
---
DESIGN.md | 8 ++++----
clj-ast.el | 2 +-
clj-edn.el | 2 +-
parseclj.el | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/DESIGN.md b/DESIGN.md
index 86083c31d1..b90ae0e577 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -121,9 +121,9 @@ Tokens can be recognized by the `:token-type` key, which
must always come first
## Shift-reduce parser
-The parser is again a single function `parseclj-reduce`. It is a higher order
function, with much of the final result determined by the `reduce-leaf` and
`reduce-node` functions passed in as arguments.
+The parser is again a single function `parseclj-parse`. It is a higher order
function, with much of the final result determined by the `reduce-leaf` and
`reduce-node` functions passed in as arguments.
-`parseclj-reduce` internally operates by using a stack. This stack contains
tokens (as returned by `clj-lex-next`), and reduced values.
+`parseclj-parse` internally operates by using a stack. This stack contains
tokens (as returned by `clj-lex-next`), and reduced values.
`reduce-leaf` is a two-argument function. It takes the current value of the
stack, and a token, and returns an updated stack, typically by parsing the
token to a value and pushing that value onto the stack.
@@ -186,7 +186,7 @@ Now the parser encounters the second closing parenthesis.
It pops everything unt
### Dealing with parse errors
-`parseclj-reduce` needs to be able to parse invalid input. Imagine analyzing a
user's buffer while they are editing, to provide contextual help or do linting.
Even when delimiters are unbalanced it should still be possible to get a "best
effort" parse result. It turns out the shift-reduce approach provides that out
of the box. The result of parsing invalid input is a stack which still has
unreduced tokens in it.
+`parseclj-parse` needs to be able to parse invalid input. Imagine analyzing a
user's buffer while they are editing, to provide contextual help or do linting.
Even when delimiters are unbalanced it should still be possible to get a "best
effort" parse result. It turns out the shift-reduce approach provides that out
of the box. The result of parsing invalid input is a stack which still has
unreduced tokens in it.
Unmatched opening delimiter:
@@ -421,7 +421,7 @@ of the newly created node.
This implementation handles `:discard' nodes (#_), for other node
types it delegates to `parseclj-ast--reduce-branch'.")
-(defun parse-clj-ast-value (node)
+(defun parseclj-ast-value (node)
"Given an AST NODE, returns its value.
Recursively convert the AST node into an Emacs Lisp value. E.g.
diff --git a/clj-ast.el b/clj-ast.el
index 21c86dfabc..7b56d3ec99 100644
--- a/clj-ast.el
+++ b/clj-ast.el
@@ -66,7 +66,7 @@
Parses code in the current buffer, starting from the current
position of (point)."
- (parseclj-reduce #'clj-ast--reduce-leaf #'clj-ast--reduce-node))
+ (parseclj-parse #'clj-ast--reduce-leaf #'clj-ast--reduce-node))
(defun clj-ast-parse-str (s)
"Parse Clojure code in string S to AST."
diff --git a/clj-edn.el b/clj-edn.el
index 4d0f09b1b5..49a8730a09 100644
--- a/clj-edn.el
+++ b/clj-edn.el
@@ -70,7 +70,7 @@ handlers as an optional argument to the reader functions.")
stack)))))
(defun clj-edn-read (&optional tag-readers)
- (parseclj-reduce #'clj-edn-reduce-leaf
+ (parseclj-parse #'clj-edn-reduce-leaf
(clj-edn-reduce-node (a-merge clj-edn-default-tag-readers
tag-readers))))
(defun clj-edn-read-str (s &optional tag-readers)
diff --git a/parseclj.el b/parseclj.el
index 1291528ae2..3b42ab20f8 100644
--- a/parseclj.el
+++ b/parseclj.el
@@ -137,7 +137,7 @@
(message "STACK: %S , CLOSER: %S" stack closer-token)
(error "Syntax Error")))))
-(defun parseclj-reduce (reduce-leaf reduce-node)
+(defun parseclj-parse (reduce-leaf reduce-node)
(let ((stack nil))
(while (not (eq (clj-lex-token-type (setq token (clj-lex-next))) :eof))
- [nongnu] elpa/parseclj c906de33a1 048/185: Rewrite all tests, and add new tests for the AST "printer", (continued)
- [nongnu] elpa/parseclj c906de33a1 048/185: Rewrite all tests, and add new tests for the AST "printer", ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 697618dbb1 049/185: Merge pull request #1 from volrath/master, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj e7686c49ed 052/185: Greater parity with edn.el, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 2da47798d9 057/185: Enable more edn.el tests, document how time/uuid are stored, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj f6de87fbe6 067/185: Split EDN and AST handling in separate files, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj d410a1530e 096/185: Add code-checking defaults to `dir-locals.el`, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 3a92eafce9 079/185: Rename reduce-node to reduce-branch, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 7beff77b15 083/185: Introduce parseclj-parse-clojure, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 3d261f5d3c 072/185: Bump version of a, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 47cf208a91 091/185: Fix parsing of tags/discard with :lexical-preservation, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj da4bacb5f5 078/185: Rename parseclj-reduce to parseclj-parse,
ELPA Syncer <=
- [nongnu] elpa/parseclj 2a42dcb6fa 066/185: Update License info in README, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj ba9f4d723f 076/185: Document proposal for alternative package organization, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj a8e1de0d62 075/185: Merge pull request #4 from lambdaisland/edn-ast-split, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 6fdf22a553 062/185: Update license, fix dependencies, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 5fbe901cba 071/185: Parse/unparse :tag, rountrip AST, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 6e0dc9516c 093/185: Add missing require, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj b79b3a5438 098/185: Add documentation to `parseclj-ast.el`, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 1b071d7775 104/185: Add documentation to `parseedn` module, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj e1cb9e5514 113/185: Add a few more node accessors., ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 80e92cdf9f 001/185: Move into its own repo, ELPA Syncer, 2021/12/28