[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yaml 1fb0519023 039/124: Fix static check warnings
From: |
ELPA Syncer |
Subject: |
[elpa] externals/yaml 1fb0519023 039/124: Fix static check warnings |
Date: |
Fri, 29 Nov 2024 15:59:57 -0500 (EST) |
branch: externals/yaml
commit 1fb05190237c9e3915a88e894d8cf9b44b007107
Author: Zachary Romero <zacromero@posteo.net>
Commit: Zachary Romero <zacromero@posteo.net>
Fix static check warnings
---
grammargen.bb | 20 ++++++++++++++++++++
yaml-tests.el | 23 +++++++++++++++++++++++
yaml.el | 49 +++++++++++++++++++++++--------------------------
3 files changed, 66 insertions(+), 26 deletions(-)
diff --git a/grammargen.bb b/grammargen.bb
index f494ffb7a9..b279bccacd 100755
--- a/grammargen.bb
+++ b/grammargen.bb
@@ -1,5 +1,22 @@
#!/usr/bin/env bb
+;; This file is not part of GNU Emacs
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; For a full copy of the GNU General Public License
+;; see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
;; This file is the Babashka script used to initially generate the YAML
grammer Elisp code.
;; The program expects to find a yaml-spec-1.2.json file in the same directory
and will
;; generate the elisp code that should go in the main grammer parsing cond.
Due to certain
@@ -7,6 +24,9 @@
;; with what is currently in yaml.el (though I don't find this a big problem
as the YAML spec
;; should never change).
+;;; Code:
+
+
(def package-prefix "yaml")
(def fn-name "yaml--parse-from-grammar")
diff --git a/yaml-tests.el b/yaml-tests.el
index 2d3e0c7f4c..65252affb6 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -1,5 +1,24 @@
;;; yaml-tests.el --- Tests for yaml.el -*- lexical-binding: t -*-
+;; This file is not part of GNU Emacs
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; For a full copy of the GNU General Public License
+;; see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file contains the unit tests for yaml.el
+
;;; Code:
(require 'yaml)
@@ -354,4 +373,8 @@ keep: |+
(should (yaml-parse-string "- # Empty
- abc")))
+
+
(provide 'yaml-tests)
+
+;; yaml-tests.el ends here
diff --git a/yaml.el b/yaml.el
index a6222eeb80..18bd94574a 100644
--- a/yaml.el
+++ b/yaml.el
@@ -5,8 +5,8 @@
;; Author: Zachary Romero <zkry@posteo.org>
;; Version: 0.1.0
;; Homepage: https://github.com/zkry/yaml.el
-;; Package-Requires: ((emacs "25.1") (cl-lib "0.6"))
-;; Keywords: YAML
+;; Package-Requires: ((emacs "25.1"))
+;; Keywords: tools
;; yaml.el requires at least GNU Emacs 25.1
@@ -242,7 +242,7 @@ This flag is intended for development purposes.")
(replace-regexp-in-string "\\(\\(?:^\\|\n\\)[^
\n][^\n]*\\)\n\\(\n+\\)\\([^\n ]\\)" "\\1\\2\\3" text)))
(defun yaml--process-literal-text (text)
- "Remvoe the header line for a folded match and return TEXT body properly
formatted with INDENTATION stripped."
+ "Remove the header line for a folded match and return TEXT body properly
formatted with INDENTATION stripped."
(let* ((header-line (substring text 0 (string-match "\n" text)))
(text-body (substring text (1+ (string-match "\n" text))))
(parsed-header (yaml--parse-block-header header-line))
@@ -342,8 +342,8 @@ This flag is intended for development purposes.")
"Create the data for a stream-end event."
'(:stream-end))
-(defun yaml--mapping-start-event (flow)
- "Process event indicating start of mapping according to FLOW."
+(defun yaml--mapping-start-event (_)
+ "Process event indicating start of mapping."
;; NOTE: currently don't have a use for FLOW
(push :mapping yaml--state-stack)
(push (make-hash-table :test 'equal) yaml--object-stack))
@@ -355,7 +355,7 @@ This flag is intended for development purposes.")
(yaml--scalar-event nil obj))
'(:mapping-end))
-(defun yaml--sequence-start-event (flow)
+(defun yaml--sequence-start-event (_)
"Process event indicating start of sequence according to FLOW."
;; NOTE: currently don't have a use for FLOW
(push :sequence yaml--state-stack)
@@ -379,7 +379,6 @@ This flag is intended for development purposes.")
Note that VALUE may be a complex object here. STYLE is
currently unused."
- (setq yaml--last-added-item value)
(let ((top-state (car yaml--state-stack))
(value (cond
((stringp value) (yaml--resolve-scalar-tag value))
@@ -453,8 +452,7 @@ reverse order."
(yaml--stream-start-event)
(setq yaml--document-start-version nil)
(setq yaml--document-start-explicit nil)
- (setq yaml--tag-map (make-hash-table))
- ))
+ (setq yaml--tag-map (make-hash-table))))
("c-flow-mapping" . (lambda ()
(yaml--mapping-start-event t)))
("c-flow-sequence" . (lambda ()
@@ -524,8 +522,7 @@ reverse order."
(if (> (length x) 1)
(substring x 1)
" "))
- replaced))
- )
+ replaced)))
(yaml--scalar-event "plain" replaced))))
("c-single-quoted" . (lambda (text)
(let* ((replaced (replace-regexp-in-string
@@ -660,8 +657,7 @@ reverse order."
(yaml--pop-state)
(if (not ,res-symbol)
nil
- (let ((res-type (cdr (assoc ,name yaml--grammar-resolution-rules)))
- (t-state (yaml--state-m (car yaml--states))))
+ (let ((res-type (cdr (assoc ,name yaml--grammar-resolution-rules))))
(cond
((or (assoc ,name yaml--grammar-events-in)
(assoc ,name yaml--grammar-events-out))
@@ -748,19 +744,20 @@ reverse order."
(setq ,rules-sym (cdr ,rules-sym)))
,res-sym))))
-;; NOTE: the reference implementation defines may, exclude, and max as follows.
-
-(defmacro yaml--may (action)
- action)
-
(defmacro yaml--exclude (_)
+ "Set the excluded characters according to RULE.
+
+This is currently unimplemented."
+ ;; NOTE: This is currently not implemented.
't)
(defmacro yaml--max (_)
+ "Automatically pass."
t)
(defun yaml--empty ()
- 'empty)
+ "Return non-nil indicating that empty rule needs nothing to pass."
+ 't)
(defun yaml--sub (a b)
"Return A minus B."
@@ -906,11 +903,11 @@ then check EXPR at the current position."
`(let ((,start-symbol yaml--parsing-position)
(_ (when (equal ,type "<=")
(setq yaml--parsing-position (1- yaml--parsing-position))))
- (ok (and (>= yaml--parsing-position 0) ,expr)))
+ (,ok-symbol (and (>= yaml--parsing-position 0) ,expr)))
(setq yaml--parsing-position ,start-symbol)
(if (equal ,type "!")
- (not ok)
- ok))))
+ (not ,ok-symbol)
+ ,ok-symbol))))
(defun yaml-parse-string (string &rest args)
"Parse the YAML value in STRING. Keyword ARGS are as follows:
@@ -1252,8 +1249,8 @@ Rules for this function are defined by the yaml-spec JSON
file."
((eq state 's-indent-le)
(let ((n (nth 0 args)))
(yaml--frame "s-indent-le"
- (yaml--may (yaml--all (yaml--rep2 0 nil (lambda ()
(yaml--parse-from-grammar 's-space)))
- (<= (length (yaml--match)) n))))))
+ (yaml--all (yaml--rep2 0 nil (lambda () (yaml--parse-from-grammar
's-space)))
+ (<= (length (yaml--match)) n)))))
((eq state 'ns-esc-carriage-return)
(yaml--frame "ns-esc-carriage-return" (yaml--chr ?\r)))
@@ -1903,8 +1900,8 @@ Rules for this function are defined by the yaml-spec JSON
file."
((eq state 's-indent-lt)
(let ((n (nth 0 args)))
(yaml--frame "s-indent-lt"
- (yaml--may (yaml--all (yaml--rep2 0 nil (lambda ()
(yaml--parse-from-grammar 's-space)))
- (< (length (yaml--match)) n))))))
+ (yaml--all (yaml--rep2 0 nil (lambda () (yaml--parse-from-grammar
's-space)))
+ (< (length (yaml--match)) n)))))
((eq state 'nb-single-one-line)
(yaml--frame "nb-single-one-line"
(yaml--rep2 0 nil (lambda () (yaml--parse-from-grammar
'nb-single-char)))))
- [elpa] externals/yaml 0c51603d6d 018/124: Add tracing; fix linting errors, (continued)
- [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, 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 <=
- [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
- [elpa] externals/yaml 10af746dad 050/124: Add option to convert string keys to symbols, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 96d3e51aeb 048/124: Add yaml-encode feature, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 51023c4551 049/124: Merge pull request #7 from zkry/add-yaml-encode, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 8903b6c7e4 055/124: return plist key as a keyword as a default, ELPA Syncer, 2024/11/29