mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 13:31:36 -07:00
Improve checks for = in command names (fixes #2102)
This commit is contained in:
parent
bd3299edd3
commit
fbb14d6b38
4 changed files with 270 additions and 26 deletions
|
@ -278,6 +278,12 @@ getUnquotedLiteral (T_NormalWord _ list) =
|
|||
str _ = Nothing
|
||||
getUnquotedLiteral _ = Nothing
|
||||
|
||||
isQuotes t =
|
||||
case t of
|
||||
T_DoubleQuoted {} -> True
|
||||
T_SingleQuoted {} -> True
|
||||
_ -> False
|
||||
|
||||
-- Get the last unquoted T_Literal in a word like "${var}foo"THIS
|
||||
-- or nothing if the word does not end in an unquoted literal.
|
||||
getTrailingUnquotedLiteral :: Token -> Maybe Token
|
||||
|
@ -296,8 +302,11 @@ getTrailingUnquotedLiteral t =
|
|||
getLeadingUnquotedString :: Token -> Maybe String
|
||||
getLeadingUnquotedString t =
|
||||
case t of
|
||||
T_NormalWord _ ((T_Literal _ s) : _) -> return s
|
||||
T_NormalWord _ ((T_Literal _ s) : rest) -> return $ s ++ from rest
|
||||
_ -> Nothing
|
||||
where
|
||||
from ((T_Literal _ s):rest) = s ++ from rest
|
||||
from _ = ""
|
||||
|
||||
-- Maybe get the literal string of this token and any globs in it.
|
||||
getGlobOrLiteralString = getLiteralStringExt f
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue