diff options
author | Julien Lepiller <julien@lepiller.eu> | 2020-10-01 15:05:05 +0200 |
---|---|---|
committer | Julien Lepiller <julien@lepiller.eu> | 2020-10-01 21:43:29 +0200 |
commit | f4390d391b5901735444cba21c94e1e23d3fc575 (patch) | |
tree | fa6170213a006fed7f69b101f6c6b088ffa48980 | |
parent | d40c9f6c85575a1abb3dac14679926e9e3bb59ca (diff) | |
download | guix-f4390d391b5901735444cba21c94e1e23d3fc575.tar guix-f4390d391b5901735444cba21c94e1e23d3fc575.tar.gz |
guix: opam: Fix syntax.
* guix/import/opam.scm (STRCHR, comment, choice): Fix syntax.
(group-pat): Add syntax.
(opam->guix-package): Suppport "archive" keyword.
-rw-r--r-- | guix/import/opam.scm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/guix/import/opam.scm b/guix/import/opam.scm index 9cda3da006..7327ab6e29 100644 --- a/guix/import/opam.scm +++ b/guix/import/opam.scm @@ -49,16 +49,19 @@ condition)) ;; Define a PEG parser for the opam format -(define-peg-pattern comment none (and "#" (* STRCHR) "\n")) +(define-peg-pattern comment none (and "#" (* COMMCHR) "\n")) (define-peg-pattern SP none (or " " "\n" comment)) (define-peg-pattern SP2 body (or " " "\n")) (define-peg-pattern QUOTE none "\"") (define-peg-pattern QUOTE2 body "\"") (define-peg-pattern COLON none ":") ;; A string character is any character that is not a quote, or a quote preceded by a backslash. +(define-peg-pattern COMMCHR none + (or " " "!" "\\" "\"" (range #\# #\頋))) (define-peg-pattern STRCHR body (or " " "!" "\n" (and (ignore "\\") "\"") - (and (ignore "\\") "\\") (range #\# #\頋))) + (ignore "\\\n") (and (ignore "\\") "\\") + (range #\# #\頋))) (define-peg-pattern operator all (or "=" "!" "<" ">")) (define-peg-pattern records body (* (and (or record weird-record) (* SP)))) @@ -69,8 +72,12 @@ (define-peg-pattern choice-pat all (and (ignore "(") (* SP) choice (* SP) (ignore ")"))) (define-peg-pattern choice body (or (and (or conditional-value ground-value) (* SP) (ignore "|") (* SP) choice) + group-pat conditional-value ground-value)) +(define-peg-pattern group-pat body + (and ground-value (* SP) (ignore "&") (* SP) + (or group-pat conditional-value ground-value))) (define-peg-pattern ground-value body (and (or multiline-string string-pat choice-pat list-pat var) (* SP))) (define-peg-pattern conditional-value all (and ground-value (* SP) condition)) (define-peg-pattern string-pat all (and QUOTE (* STRCHR) QUOTE)) @@ -258,7 +265,8 @@ or #f on failure." (version (assoc-ref opam-file "version")) (opam-content (assoc-ref opam-file "metadata")) (url-dict (metadata-ref opam-content "url")) - (source-url (metadata-ref url-dict "src")) + (source-url (or (metadata-ref url-dict "src") + (metadata-ref url-dict "archive"))) (requirements (metadata-ref opam-content "depends")) (dependencies (dependency-list->names requirements)) (native-dependencies (depends->native-inputs requirements)) @@ -308,7 +316,7 @@ or #f on failure." (filter (lambda (name) (not (member name '("dune" "jbuilder")))) - dependencies)))))))) + dependencies)))))))) (define (opam-recursive-import package-name) (recursive-import package-name #f |