[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yaml 0c51603d6d 018/124: Add tracing; fix linting error
From: |
ELPA Syncer |
Subject: |
[elpa] externals/yaml 0c51603d6d 018/124: Add tracing; fix linting errors |
Date: |
Fri, 29 Nov 2024 15:59:54 -0500 (EST) |
branch: externals/yaml
commit 0c51603d6d924a6b51fe8ba43093c534d8a3e95b
Author: Zachary Romero <zacromero@posteo.net>
Commit: Zachary Romero <zacromero@posteo.net>
Add tracing; fix linting errors
---
yaml.el | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/yaml.el b/yaml.el
index 7e4d479a23..cc13807b1d 100644
--- a/yaml.el
+++ b/yaml.el
@@ -30,6 +30,8 @@
;;; Code:
+(require 'seq)
+
(defvar yaml--parse-debug nil
"Turn on debugging messages when parsing YAML when non-nil.
@@ -60,7 +62,6 @@ This flag is intended for development purposes.")
(defvar yaml--parsing-null-object nil)
(defvar yaml--parsing-false-object nil)
-;; TODO: rename this to have two dashes.
(cl-defstruct (yaml--state (:constructor yaml--state-create)
(:copier nil))
doc tt m name lvl beg end)
@@ -386,7 +387,7 @@ This flag is intended for development purposes.")
(setcar yaml--object-stack (reverse (car yaml--object-stack))))
(defconst yaml--grammar-events-in
- '(("l-yaml-stream" . (lambda ()
+ '(("l-yaml-stream" . (lambda () ;; TODO remvoe yaml--add-event
(yaml--add-event (yaml--stream-start-event))
(setq yaml--document-start-version nil)
(setq yaml--document-start-explicit nil)
@@ -566,19 +567,22 @@ This flag is intended for development purposes.")
(declare (indent defun))
(let ((res-symbol (make-symbol "res")))
`(let ((beg yaml--parsing-position)
- (_ (yaml--push-state ,name))
- (,res-symbol ,rule))
+ (_ (when (and yaml--parse-debug ,res-symbol (not (member ,name
yaml--tracing-ignore)))
+ (message "|%s>%s %40s \"%s\""
+ (make-string (length yaml--states) ?-)
+ (make-string (- 70 (length yaml--states)) ?\s)
+ ,name
+ (replace-regexp-in-string "\n" "\\n"
+ (substring
yaml--parsing-input yaml--parsing-position)
+ nil 'literal))))
+ (_ (yaml--push-state ,name))
+ (,res-symbol ,rule))
(when (and yaml--parse-debug ,res-symbol (not (member ,name
yaml--tracing-ignore)))
- (message "<%s|%s %40s \"%s\""
+ (message "<%s|%s %40s = %s"
(make-string (length yaml--states) ?-)
- (make-string (- 40 (length yaml--states)) ?\s)
+ (make-string (- 70 (length yaml--states)) ?\s)
,name
- (replace-regexp-in-string
- "\n"
- "\\n"
- (substring yaml--parsing-input beg yaml--parsing-position)
- nil
- 'literal)))
+ ,res-symbol))
(yaml--pop-state)
(if (not ,res-symbol)
nil
@@ -669,7 +673,6 @@ This flag is intended for development purposes.")
`(lambda () ,form))
forms)))
-;; Not sure if this actually helps the stack problem
(defmacro yaml--any (&rest forms)
"Pass if any of FORMS pass."
(if (= 1 (length forms))
@@ -764,6 +767,7 @@ This flag is intended for development purposes.")
(string-match "\\^g(?:---|\\.\\.\\.\\)\\([[:blank:]]\\|$\\)"
(substring yaml--parsing-input yaml--parsing-position)))))
(defun yaml--ord (f)
+ "Convert an ASCII number returned by F to a number."
(let ((res (funcall f)))
(- (aref res 0) 48)))
@@ -828,7 +832,7 @@ This flag is intended for development purposes.")
(yaml--parse-from-grammar 'l-yaml-stream))
(defmacro yaml--set (variable value)
- "Set the current state of VARIABLE to VALUE"
+ "Set the current state of VARIABLE to VALUE."
(let ((res-sym (make-symbol "res")))
`(let ((,res-sym ,value))
(when ,res-sym
@@ -838,6 +842,11 @@ This flag is intended for development purposes.")
,res-sym))))
(defmacro yaml--chk (type expr)
+ "Check if EXPR is non-nil at the parsing position.
+
+If TYPE is \"<=\" then check at the previous position. If TYPE
+is \"!\" ensure that EXPR is nil. Otherwise, if TYPE is \"=\"
+then check EXPR at the current position."
(let ((start-symbol (make-symbol "start"))
(ok-symbol (make-symbol "ok")))
`(let ((,start-symbol yaml--parsing-position)
- [elpa] externals/yaml 14e6e4bc3d 095/124: Merge pull request #37 from zkry/fix-folded-block-parsing-error, (continued)
- [elpa] externals/yaml 14e6e4bc3d 095/124: Merge pull request #37 from zkry/fix-folded-block-parsing-error, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0ac7f365bb 104/124: Merge pull request #41 from zkry/fix-property-prop-bug, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 900ca55584 119/124: Fix failing test for parsing scalars, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 964ef3b105 014/124: process literal and folded, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml a1d6e3211c 007/124: Initial working yaml-parser, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 5c52737f17 005/124: Start on event handling, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml aba7c19c47 020/124: Remove yaml spec, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 7c6c1e1abf 017/124: Rename names according to elisp standards, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 9a8ae65986 016/124: Reduce stack usage, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 9e18a714f5 006/124: completing tracer to parse basic key-value, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0c51603d6d 018/124: Add tracing; fix linting errors,
ELPA Syncer <=
- [elpa] externals/yaml 49f4ebd8ab 011/124: Minor bug fixes, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 70429bd21b 025/124: Fix s-l+block-indented bug; fix auto-detect-indent bug, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml ed9dded709 027/124: Fix l+block-mapping auto-detect-indent bug, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 837e3e3080 028/124: Format grammar code, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml b7cffd6d3e 021/124: Add .gitattributes file, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml e32e11be66 026/124: Fix l+block-sequence bug sequence with e-node, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml ab86db9bb2 044/124: Merge pull request #4 from zkry/pcase-related-modifications, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml ada133f0b1 036/124: Fix regexp to match end of string, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 9170ff5cf8 038/124: Add LICENSE; Add documentation, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 1fb0519023 039/124: Fix static check warnings, ELPA Syncer, 2024/11/29