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

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

[nongnu] elpa/parseclj adbc0cabf5 100/185: Move `parseclj--{leaf, closin


From: ELPA Syncer
Subject: [nongnu] elpa/parseclj adbc0cabf5 100/185: Move `parseclj--{leaf, closing}-tokens` to `parseclj-lex` module
Date: Tue, 28 Dec 2021 14:05:24 -0500 (EST)

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

    Move `parseclj--{leaf,closing}-tokens` to `parseclj-lex` module
---
 parseclj-ast.el |  5 +++--
 parseclj-lex.el | 24 +++++++++++++++++++++---
 parseclj.el     | 17 -----------------
 3 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/parseclj-ast.el b/parseclj-ast.el
index 873bb49648..190c3e6a75 100644
--- a/parseclj-ast.el
+++ b/parseclj-ast.el
@@ -27,6 +27,7 @@
 
 ;;; Code:
 
+(require 'parseclj-lex)
 (require 'parseedn)
 
 ;; AST helper functions
@@ -48,11 +49,11 @@ Other ATTRIBUTES can be given as a flat list of key-value 
pairs."
 
 (defun parseclj-ast-leaf-node? (node)
   "Return t if the given ast NODE is a leaf node."
-  (member (parseclj-ast-node-type node) parseclj--leaf-tokens))
+  (member (parseclj-ast-node-type node) parseclj-lex--leaf-tokens))
 
 ;; Parse/reduce strategy functions
 
-(defun parseclj-ast--reduce-leaf (stack token options)
+(defun parseclj-ast--reduce-leaf (stack token &optional options)
   "Put into the STACK an AST leaf node based on TOKEN.
 Ignores white spaces and comments.
 
diff --git a/parseclj-lex.el b/parseclj-lex.el
index df59881f67..5831933e7b 100644
--- a/parseclj-lex.el
+++ b/parseclj-lex.el
@@ -25,7 +25,25 @@
 
 ;; A reader for EDN data files and parser for Clojure source files.
 
-;;; Code
+;;; Code:
+
+(defvar parseclj-lex--leaf-tokens '(:whitespace
+                                    :comment
+                                    :number
+                                    :nil
+                                    :true
+                                    :false
+                                    :symbol
+                                    :keyword
+                                    :string
+                                    :character)
+  "Types of tokens that represent leaf nodes in the AST.")
+
+(defvar parseclj-lex--closing-tokens '(:rparen
+                                       :rbracket
+                                       :rbrace)
+  "Types of tokens that mark the end of a non-atomic form.")
+
 
 (defun parseclj-lex-token (type form pos &rest attributes)
   "Create a lexer token with the specified attributes.
@@ -53,11 +71,11 @@ A token is an association list with :token-type as its 
first key. "
 
 (defun parseclj-lex-leaf-token? (token)
   "Return `t' if the given ast TOKEN is a leaf node."
-  (member (parseclj-lex-token-type token) parseclj--leaf-tokens))
+  (member (parseclj-lex-token-type token) parseclj-lex--leaf-tokens))
 
 (defun parseclj-lex-closing-token? (token)
   "Return `t' if the given ast TOKEN is a closing toking."
-  (member (parseclj-lex-token-type token) parseclj--closing-tokens))
+  (member (parseclj-lex-token-type token) parseclj-lex--closing-tokens))
 
 (defun parseclj-lex-at-whitespace? ()
   (let ((char (char-after (point))))
diff --git a/parseclj.el b/parseclj.el
index ef59a4153b..8d60df3b89 100644
--- a/parseclj.el
+++ b/parseclj.el
@@ -38,23 +38,6 @@
 (require 'parseclj-ast)
 (require 'parseclj-unparse)
 
-(defvar parseclj--leaf-tokens '(:whitespace
-                                :comment
-                                :number
-                                :nil
-                                :true
-                                :false
-                                :symbol
-                                :keyword
-                                :string
-                                :character)
-  "Types of tokens that represent leaf nodes in the AST.")
-
-(defvar parseclj--closing-tokens '(:rparen
-                                   :rbracket
-                                   :rbrace)
-  "Types of tokens that mark the end of a non-atomic form.")
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Shift-Reduce Parser
 



reply via email to

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