bash 0.1.2 → 0.1.3
raw patch · 4 files changed
+18/−13 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Language/Bash/PrettyPrinter.hs +1/−1
- Language/Bash/PrettyPrinter/State.hs +7/−6
- bash.cabal +1/−1
- tests.bash +9/−5
Language/Bash/PrettyPrinter.hs view
@@ -209,7 +209,7 @@ [ ] -> 0 h:t -> (fromIntegral . length . List.last) (h:t) -inlineEvalPrinter open close ann = do+inlineEvalPrinter open close ann = do indentPadToNextWord hangWord open pp ann
Language/Bash/PrettyPrinter/State.hs view
@@ -82,20 +82,21 @@ Newline | columns == 0 -> state { separated = True } | otherwise -> state { string = sNL, columns = 0 , separated = True }- Bytes b -> state { string = s', columns = c' }+ Bytes b -> state { string = s', columns = c'+ , separated = True } where c' = columns + cast (length padded + length sSep) s' = sappend padded- dent = cast (sum indents) `replicate` ' '- padded | columns == 0 = dent `mappend` b- | otherwise = b+ padded = mappend dent b where+ dent | columns == 0 = cast (sum indents) `replicate` ' '+ | otherwise = "" sappend = mappend string . Builder.fromByteString . mappend sSep tSafe list = if null list then [] else List.tail list sNL = sappend "\n"- curly_s = sappend "{"+ curly_s = sappend (mappend dent "{") s_curly = sappend ";}"- round_s = sappend "("+ round_s = sappend (mappend dent "(") s_round = sappend ")" sSep | not separated = " " | otherwise = ""
bash.cabal view
@@ -1,5 +1,5 @@ name : bash-version : 0.1.2+version : 0.1.3 category : Language license : BSD3 license-file : LICENSE
tests.bash view
@@ -289,27 +289,31 @@ echo "${string#"${patterns[leading]}"}" "${string%"${patterns[trailing]}"}" \ "${string#*/}" "${string##*/}" "${string%/*}" "${string%%/*}" -#redirectIn y c = Redirect (ann_ c) In 0 (Left y) #> let redirectI f stmt = Redirect (Annotated () stmt) In 0 (Left f) #> let redirectO f stmt = Redirect (Annotated () stmt) Out 1 (Left f) #> let redirectE f stmt = Redirect (Annotated () stmt) Out 2 (Left f) #> let clauseSimple ex stmt = (ex, Annotated () stmt) #> let echo_ = SimpleCommand "echo" #> let echo__ t = Sequence (Annotated () (echo_ [t])) (Annotated () (echo_ [t]))+#> let echoIO = (redirectO "o" . redirectI "i") (echo_ ["->y"])+#> let setFOO = VarAssign "foo" (Eval seq4) #> let c__ = clauseSimple "w" (echo_ ["->w"])-##> let c2 = clauseSimple "x" (echo__ "->x") #> let c2 = clauseSimple "x" ((Bang . Annotated()) (echo__ "->x"))-##> let c2 = clauseSimple "x" ((redirectI "i") (echo__ "->x"))-#> let cIO = clauseSimple "y" ((redirectO "o" . redirectI "i") (echo_ ["->y"]))+#> let cIO = clauseSimple "y" echoIO #> let cI_ = clauseSimple "z" (redirectI "i" (echo_ ["->z"]))+#> let long = Sequence (Annotated() setFOO) (Annotated() echoIO)+#> let cL = clauseSimple "a" long #> let read_1 = ReadVarSafe (VarSpecial Dollar1)-#> let caseClauseRedirect = Annotated () (Case read_1 [c__, c2, cI_, cIO])+#> let caseClauseRedirect = Annotated () (Case read_1 [c__, c2, cIO, cI_, cL]) #> render caseClauseRedirect case "${1:-}" in w) echo $'->w' ;; x) ! { echo $'->x' echo $'->x' ;} ;;+ y) { echo $'->y' 0<i ;} 1>o ;; z) echo $'->z' 0<i ;;+ a) foo="$( seq 1 4 )"+ { echo $'->y' 0<i ;} 1>o ;; esac #> let echo2 = Annotated () ((Bang . Annotated()) (echo__ "->x"))