about summary refs log tree commit diff
path: root/parse.nix
diff options
context:
space:
mode:
Diffstat (limited to 'parse.nix')
-rw-r--r--parse.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/parse.nix b/parse.nix
index 6244b6954fbe..3fc18b7f0a46 100644
--- a/parse.nix
+++ b/parse.nix
@@ -6,6 +6,19 @@ let
     (x: builtins.typeOf x == "string")
     (builtins.split _sep _s);
 
+  # Parse (all) Package-Requires elisp headers found in the input string
+  # `packageFile` into a list of package name strings.
+  #
+  # Example inputs:
+  #
+  #  ;; Package-Requires: ()
+  #  => [ ]
+  #  ;; Package-Requires: ((dash "2.12.1") (pkg-info "0.4") (let-alist "1.0.4") (seq "1.11") (emacs "24.3"))
+  #  => [ "dash" "pkg-info" "let-alist" "seq" "emacs" ]
+  #  ;; Package-Requires: (dash (pkg-info "0.4"))
+  #  => [ "dash" "pkg-info" ]
+  #  ;; Package-Requires: ((dash) (pkg-info "0.4"))
+  #  => [ "dash" "pkg-info" ]
   parsePackagesFromPackageRequires = packageFile:
     let
       lines = splitString "\r?\n" packageFile;