import: cabal: Allow curly bracket before else statement.

* guix/import/cabal.scm (is-else): Turn into procedure.
(lex-line): Move IS-ELSE…
(lex-word): …here.
* tests/hackage.scm (test-cabal-elif-brackets): Extend testcase.
This commit is contained in:
Lars-Dominik Braun 2022-05-01 08:34:42 +02:00
parent 001e0bac99
commit e3337f35af
No known key found for this signature in database
GPG Key ID: F663943E08D8092A
2 changed files with 6 additions and 3 deletions

View File

@ -384,7 +384,7 @@ matching a string against the created regexp."
(define is-lib (make-rx-matcher "^library *" regexp/icase))
(define is-else (make-rx-matcher "^else" regexp/icase))
(define (is-else s) (string-ci=? s "else"))
(define (is-elif s) (string-ci=? s "elif"))
@ -576,6 +576,7 @@ LOC is the current port location."
(let* ((w (read-delimited " <>=():\t\n" port 'peek)))
(cond ((is-if w) (lex-if loc))
((is-elif w) (lex-elif loc))
((is-else w) (lex-else loc))
((is-test w port) (lex-test w loc))
((is-true w) (lex-true loc))
((is-false w) (lex-false loc))
@ -599,7 +600,6 @@ the current port location."
((is-custom-setup s) => (cut lex-custom-setup <> loc))
((is-benchmark s) => (cut lex-benchmark <> loc))
((is-lib s) (lex-lib loc))
((is-else s) (lex-else loc))
(else (unread-string s port) #f))))
(define (lex-property port loc)

View File

@ -398,7 +398,10 @@ library
elif os(guix) { Build-depends: ghc-c }
elif os(third) {
Build-depends: ghc-d }
else
elif os(fourth)
{
Build-depends: ghc-d
} else
Build-depends: ghc-e
")