Reparse indices after attaching here docs (fixes #2846)
This commit is contained in:
parent
f2729f73cb
commit
a9e7bf1950
|
@ -516,6 +516,9 @@ prop_hereDocsAreParsedWithoutTrailingLinefeed = 1044 `elem` result
|
||||||
where
|
where
|
||||||
result = check "cat << eof"
|
result = check "cat << eof"
|
||||||
|
|
||||||
|
prop_hereDocsWillHaveParsedIndices = null result
|
||||||
|
where
|
||||||
|
result = check "#!/bin/bash\nmy_array=(a b)\ncat <<EOF >> ./test\n $(( 1 + my_array[1] ))\nEOF"
|
||||||
|
|
||||||
return []
|
return []
|
||||||
runTests = $quickCheckAll
|
runTests = $quickCheckAll
|
||||||
|
|
|
@ -3339,7 +3339,8 @@ readScriptFile sourced = do
|
||||||
verifyEof
|
verifyEof
|
||||||
let script = T_Annotation annotationId annotations $
|
let script = T_Annotation annotationId annotations $
|
||||||
T_Script id shebang commands
|
T_Script id shebang commands
|
||||||
reparseIndices script
|
userstate <- getState
|
||||||
|
reparseIndices $ reattachHereDocs script (hereDocMap userstate)
|
||||||
else do
|
else do
|
||||||
many anyChar
|
many anyChar
|
||||||
id <- endSpan start
|
id <- endSpan start
|
||||||
|
@ -3487,8 +3488,7 @@ parseShell env name contents = do
|
||||||
return newParseResult {
|
return newParseResult {
|
||||||
prComments = map toPositionedComment $ nub $ parseNotes userstate ++ parseProblems state,
|
prComments = map toPositionedComment $ nub $ parseNotes userstate ++ parseProblems state,
|
||||||
prTokenPositions = Map.map startEndPosToPos (positionMap userstate),
|
prTokenPositions = Map.map startEndPosToPos (positionMap userstate),
|
||||||
prRoot = Just $
|
prRoot = Just script
|
||||||
reattachHereDocs script (hereDocMap userstate)
|
|
||||||
}
|
}
|
||||||
Left err -> do
|
Left err -> do
|
||||||
let context = contextStack state
|
let context = contextStack state
|
||||||
|
|
Loading…
Reference in New Issue