emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/parseclj e1cb9e5514 113/185: Add a few more node accessors


From: ELPA Syncer
Subject: [nongnu] elpa/parseclj e1cb9e5514 113/185: Add a few more node accessors.
Date: Tue, 28 Dec 2021 14:05:26 -0500 (EST)

branch: elpa/parseclj
commit e1cb9e551458f57f398b27f75d2e3dcaf3cd3e70
Author: Daniel Barreto <daniel.barreto.n@gmail.com>
Commit: Daniel Barreto <daniel.barreto.n@gmail.com>

    Add a few more node accessors.
---
 parseclj-ast.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/parseclj-ast.el b/parseclj-ast.el
index 72793fdc57..26adeced61 100644
--- a/parseclj-ast.el
+++ b/parseclj-ast.el
@@ -44,14 +44,30 @@ Other ATTRIBUTES can be given as a flat list of key-value 
pairs."
        (consp (car node))
        (eq :node-type (caar node))))
 
+(defun parseclj-ast-node-attr (node attr)
+  "Return NODE's ATTR, or nil."
+  (a-get node attr))
+
 (defun parseclj-ast-node-type (node)
   "Return the type of the AST node NODE."
   (a-get node :node-type))
 
+(defun parseclj-ast-children (node)
+  "Return children for the AST NODE."
+  (a-get node :children))
+
+(defun parseclj-ast-value (node)
+  "Return the value of NODE as another AST node."
+  (a-get node :value))
+
 (defun parseclj-ast-leaf-node-p (node)
   "Return t if the given ast NODE is a leaf node."
   (member (parseclj-ast-node-type node) parseclj-lex--leaf-tokens))
 
+(defun parseclj-ast-branch-node-p (node)
+  "Return t if the given AST NODE is a branch node."
+  (not (parseclj-ast-leaf-node-p node)))
+
 
 ;; Parse/reduce strategy functions
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]