Allow parsing arbitrary coproc names (fixes #3048)

This commit is contained in:
Vidar Holen
2024-09-07 17:14:52 -07:00
parent ca65071d77
commit 79e43c4550
4 changed files with 46 additions and 13 deletions

View File

@@ -668,10 +668,18 @@ build t = do
status <- newNodeRange $ CFSetExitCode id
linkRange cond status
T_CoProc id maybeName t -> do
let name = fromMaybe "COPROC" maybeName
T_CoProc id maybeNameToken t -> do
-- If unspecified, "COPROC". If not a constant string, Nothing.
let maybeName = case maybeNameToken of
Just x -> getLiteralString x
Nothing -> Just "COPROC"
let parentNode = case maybeName of
Just str -> applySingle $ IdTagged id $ CFWriteVariable str CFValueArray
Nothing -> CFStructuralNode
start <- newStructuralNode
parent <- newNodeRange $ applySingle $ IdTagged id $ CFWriteVariable name CFValueArray
parent <- newNodeRange parentNode
child <- subshell id "coproc" $ build t
end <- newNodeRange $ CFSetExitCode id