Control Flow Graph / Data Flow Analysis support

This commit is contained in:
Vidar Holen 2022-07-19 14:23:27 -07:00
parent 7946bf5657
commit f77a545282
17 changed files with 2909 additions and 135 deletions

View file

@ -27,6 +27,7 @@ import ShellCheck.AST
import ShellCheck.ASTLib hiding (runTests)
import ShellCheck.Data
import ShellCheck.Interface
import ShellCheck.Prelude
import Control.Applicative ((<*), (*>))
import Control.Monad
@ -210,7 +211,7 @@ getNextIdSpanningTokenList list =
-- Get the span covered by an id
getSpanForId :: Monad m => Id -> SCParser m (SourcePos, SourcePos)
getSpanForId id =
Map.findWithDefault (error "Internal error: no position for id. Please report!") id <$>
Map.findWithDefault (error $ pleaseReport "no parser span for id") id <$>
getMap
-- Create a new id with the same span as an existing one
@ -1918,7 +1919,7 @@ readPendingHereDocs = do
-- The end token is just a prefix
skipLine
| hasTrailer ->
error "ShellCheck bug, please report (here doc trailer)."
error $ pleaseReport "unexpected heredoc trailer"
-- The following cases assume no trailing text:
| dashed == Undashed && (not $ null leadingSpace) -> do