mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-11 15:46:26 -07:00
Merge branch 'opqaque-interface' of https://github.com/ngzhian/shellcheck into ngzhian-opqaque-interface
This commit is contained in:
commit
932e2b3538
8 changed files with 186 additions and 52 deletions
|
@ -3051,11 +3051,11 @@ debugParseScript string =
|
|||
result {
|
||||
-- Remove the noisiest parts
|
||||
prTokenPositions = Map.fromList [
|
||||
(Id 0, (Position {
|
||||
(Id 0, (newPosition {
|
||||
posFile = "removed for clarity",
|
||||
posLine = -1,
|
||||
posColumn = -1
|
||||
}, Position {
|
||||
}, newPosition {
|
||||
posFile = "removed for clarity",
|
||||
posLine = -1,
|
||||
posColumn = -1
|
||||
|
@ -3144,14 +3144,14 @@ parseShell env name contents = do
|
|||
(result, state) <- runParser env (parseWithNotes readScript) name contents
|
||||
case result of
|
||||
Right (script, userstate) ->
|
||||
return ParseResult {
|
||||
return newParseResult {
|
||||
prComments = map toPositionedComment $ nub $ parseNotes userstate ++ parseProblems state,
|
||||
prTokenPositions = Map.map startEndPosToPos (positionMap userstate),
|
||||
prRoot = Just $
|
||||
reattachHereDocs script (hereDocMap userstate)
|
||||
}
|
||||
Left err ->
|
||||
return ParseResult {
|
||||
return newParseResult {
|
||||
prComments =
|
||||
map toPositionedComment $
|
||||
notesForContext (contextStack state)
|
||||
|
@ -3218,10 +3218,18 @@ reattachHereDocs root map =
|
|||
|
||||
toPositionedComment :: ParseNote -> PositionedComment
|
||||
toPositionedComment (ParseNote start end severity code message) =
|
||||
PositionedComment (posToPos start) (posToPos end) $ Comment severity code message
|
||||
newPositionedComment {
|
||||
pcStartPos = (posToPos start)
|
||||
, pcEndPos = (posToPos end)
|
||||
, pcComment = newComment {
|
||||
cSeverity = severity
|
||||
, cCode = code
|
||||
, cMessage = message
|
||||
}
|
||||
}
|
||||
|
||||
posToPos :: SourcePos -> Position
|
||||
posToPos sp = Position {
|
||||
posToPos sp = newPosition {
|
||||
posFile = sourceName sp,
|
||||
posLine = fromIntegral $ sourceLine sp,
|
||||
posColumn = fromIntegral $ sourceColumn sp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue