[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yaml e32e11be66 026/124: Fix l+block-sequence bug seque
From: |
ELPA Syncer |
Subject: |
[elpa] externals/yaml e32e11be66 026/124: Fix l+block-sequence bug sequence with e-node |
Date: |
Fri, 29 Nov 2024 15:59:55 -0500 (EST) |
branch: externals/yaml
commit e32e11be662194d4950c51e0bb607770b767e78f
Author: Zachary Romero <zacromero@posteo.net>
Commit: Zachary Romero <zacromero@posteo.net>
Fix l+block-sequence bug sequence with e-node
---
yaml-tests.el | 4 +++-
yaml.el | 41 ++++++++++++++++++++++++++---------------
2 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/yaml-tests.el b/yaml-tests.el
index 5079a582f1..15793dd9cb 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -482,6 +482,8 @@ keep: |+
"))
(should (yaml-parse-string "block sequence:
- one
- - two : three")))
+ - two : three"))
+ (should (yaml-parse-string "- # Empty
+- abc")))
(provide 'yaml-tests)
diff --git a/yaml.el b/yaml.el
index a5c8e86f0c..cdef905dfb 100644
--- a/yaml.el
+++ b/yaml.el
@@ -371,7 +371,8 @@ This flag is intended for development purposes.")
((stringp value) (yaml--resolve-scalar-tag value))
((listp value) (yaml--format-list value))
((hash-table-p value) (yaml--format-object value))
- ((vectorp value) value))))
+ ((vectorp value) value)
+ ((not value) nil))))
(cond
((not top-state)
(setq yaml--root value))
@@ -575,7 +576,8 @@ This flag is intended for development purposes.")
(let* ((processed-text (yaml--process-folded-text text)))
(yaml--add-event (yaml--scalar-event "folded"
processed-text)))))
("e-scalar" . (lambda (text)
- (yaml--add-event (yaml--scalar-event "plain" ""))))
+ (message "DEBUG adding e-scalar")
+ (yaml--add-event (yaml--scalar-event "plain" "null"))))
("c-ns-anchor-property" . (lambda (text)
(yaml--anchor-event (substring text 1))))
("c-ns-tag-property" . (lambda (text)
@@ -584,8 +586,7 @@ This flag is intended for development purposes.")
("l-trail-comments" . (lambda (text)
(yaml--add-event (yaml--trail-comments-event
text))))
("c-ns-alias-node" . (lambda (text)
- (yaml--add-event (yaml--alias-event (substring text
1)))))
- ))
+ (yaml--add-event (yaml--alias-event (substring text
1)))))))
(defun yaml--walk-events (tree)
"Event walker iterates over the parse TREE and signals events based off of
the parsed rules."
@@ -616,15 +617,15 @@ This flag is intended for development purposes.")
(make-string (- 70 (length yaml--states)) ?\s)
,name
args
- (substring yaml--parsing-input
yaml--parsing-position))))
+ (yaml--slice 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"
+ (message "<%s|%s %40s = '%s'"
(make-string (length yaml--states) ?-)
(make-string (- 70 (length yaml--states)) ?\s)
,name
- ))
+ (substring yaml--parsing-input beg yaml--parsing-position)))
(yaml--pop-state)
(if (not ,res-symbol)
nil
@@ -1387,12 +1388,16 @@ Rules for this function are defined by the yaml-spec
JSON file."
((eq state 'l+block-sequence)
(yaml--frame "l+block-sequence"
- (yaml--all (yaml--set m (yaml--auto-detect-indent (nth 0
args)))
- (yaml--rep 1 nil
- (lambda ()
- (yaml--all
- (yaml--parse-from-grammar 's-indent
(+ (nth 0 args) (yaml--state-curr-m)))
- (yaml--parse-from-grammar
'c-l-block-seq-entry (+ (nth 0 args) (yaml--state-curr-m)))))))))
+ ;; NOTE: deviated from the spec example here by making new-m at least 1.
The wording and examples lead me to believe this is how it's done.
+ ;; ie /* For some fixed auto-detected m > 0 */
+ (let ((new-m (max (yaml--auto-detect-indent (nth 0 args)) 1)))
+ (message "DEBUG l+block-sequence: %s %s" (nth 0 args) new-m)
+ (yaml--all (yaml--set m new-m)
+ (yaml--rep 1 nil
+ (lambda ()
+ (yaml--all
+ (yaml--parse-from-grammar 's-indent (+ (nth 0
args) new-m))
+ (yaml--parse-from-grammar
'c-l-block-seq-entry (+ (nth 0 args) new-m)))))))))
((eq state 'c-double-quote) (yaml--frame "c-double-quote" (yaml--chr ?\")))
((eq state 'ns-esc-backspace) (yaml--frame "ns-esc-backspace" (yaml--chr
?\b)))
@@ -1403,8 +1408,14 @@ Rules for this function are defined by the yaml-spec
JSON file."
((eq state 'c-non-specific-tag) (yaml--frame "c-non-specific-tag"
(yaml--chr ?\!)))
((eq state 'l-directive-document) (yaml--frame "l-directive-document"
(yaml--all (yaml--rep 1 nil (lambda () (yaml--parse-from-grammar
'l-directive))) (yaml--parse-from-grammar 'l-explicit-document))))
((eq state 'c-l-block-map-explicit-entry) (let ((n (nth 0 args)))
(yaml--frame "c-l-block-map-explicit-entry" (yaml--all
(yaml--parse-from-grammar 'c-l-block-map-explicit-key n) (yaml--any
(yaml--parse-from-grammar 'l-block-map-explicit-value n)
(yaml--parse-from-grammar 'e-node))))))
- ((eq state 'e-node) (yaml--frame "e-node" (yaml--parse-from-grammar
'e-scalar)))
- ((eq state 'seq-spaces) (let ((n (nth 0 args)) (c (nth 1 args)))
(yaml--frame "seq-spaces" (cond ((equal c "block-in") n) ((equal c "block-out")
(yaml--sub n 1))))))
+ ((eq state 'e-node)
+ (yaml--frame "e-node"
+ (yaml--parse-from-grammar 'e-scalar)))
+ ((eq state 'seq-spaces)
+ (let ((n (nth 0 args)) (c (nth 1 args)))
+ (yaml--frame "seq-spaces"
+ (cond ((equal c "block-in") n)
+ ((equal c "block-out") (yaml--sub n 1))))))
((eq state 'l-yaml-stream) (yaml--frame "l-yaml-stream" (yaml--all
(yaml--rep2 0 nil (lambda () (yaml--parse-from-grammar 'l-document-prefix)))
(yaml--rep 0 1 (lambda () (yaml--parse-from-grammar 'l-any-document)))
(yaml--rep2 0 nil (lambda () (yaml--any (yaml--all (yaml--rep 1 nil (lambda ()
(yaml--parse-from-grammar 'l-document-suffix))) (yaml--rep2 0 nil (lambda ()
(yaml--parse-from-grammar 'l-document-prefix))) (yaml--rep 0 1 (lambda ()
(yaml--parse-from-grammar 'l-any-document))) [...]
((eq state 'nb-double-one-line) (yaml--frame "nb-double-one-line"
(yaml--rep2 0 nil (lambda () (yaml--parse-from-grammar 'nb-double-char)))))
((eq state 's-l-comments) (yaml--frame "s-l-comments" (yaml--all (yaml--any
(yaml--parse-from-grammar 's-b-comment) (yaml--start-of-line)) (yaml--rep2 0
nil (lambda () (yaml--parse-from-grammar 'l-comment))))))
- [elpa] externals/yaml aba7c19c47 020/124: Remove yaml spec, (continued)
- [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, 2024/11/29
- [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 <=
- [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
- [elpa] externals/yaml fbf28ffb1d 041/124: Add yaml-spec-1.2.json file, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml d8f676b54d 037/124: Add require for cl-lib, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml a90fc1580c 045/124: Update commentary file, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 79a6bbc1e1 040/124: Fix various parsing bugs; reduce stack usage of parsing strings, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 367f470203 029/124: Add github action file, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml a45f60c999 051/124: Merge pull request #8 from zkry/symbol-keys, ELPA Syncer, 2024/11/29