Skip to content

Commit

Permalink
Bugfix for empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
schoettl committed Aug 18, 2020
1 parent 776a465 commit d957bb9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ shelltestfile = do
trailingComments <- many whitespaceorcommentline
ptrace_ "shelltestfile 2"
eof
let ts' = init ts ++ [(last ts) { trailingComments = trailingComments }]
let ts' = appendTrailingComments trailingComments ts
ptrace "shelltestfile ." ts'
return ts'

Expand Down Expand Up @@ -328,6 +328,11 @@ delimiterNotNewTest3 = do
----------------------------------------------------------------------
-- common

appendTrailingComments :: [String] -> [ShellTest] -> [ShellTest]
appendTrailingComments _ [] = [] -- in this case, trailing comment are discarded
appendTrailingComments cs ts =
init ts ++ [(last ts) { trailingComments = cs }]

linesBetween :: [String] -> [String] -> Parser String
linesBetween startdelims enddelims = do
let delimp "" = string ""
Expand Down

0 comments on commit d957bb9

Please sign in to comment.