mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-28 07:19:58 +08:00
Refactor definition of special variables.
This ensures that the parser and other places that refer to special variables can use the same list.
This commit is contained in:
committed by
Benjamin Gordon
parent
50116e8aee
commit
0358090b3c
@@ -47,6 +47,8 @@ variablesWithoutSpaces = specialVariablesWithoutSpaces ++ [
|
|||||||
"COLUMNS", "HISTFILESIZE", "HISTSIZE", "LINES"
|
"COLUMNS", "HISTFILESIZE", "HISTSIZE", "LINES"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
specialVariables = specialVariablesWithoutSpaces ++ ["@", "*"]
|
||||||
|
|
||||||
arrayVariables = [
|
arrayVariables = [
|
||||||
"BASH_ALIASES", "BASH_ARGC", "BASH_ARGV", "BASH_CMDS", "BASH_LINENO",
|
"BASH_ALIASES", "BASH_ARGC", "BASH_ARGV", "BASH_CMDS", "BASH_LINENO",
|
||||||
"BASH_REMATCH", "BASH_SOURCE", "BASH_VERSINFO", "COMP_WORDS", "COPROC",
|
"BASH_REMATCH", "BASH_SOURCE", "BASH_VERSINFO", "COMP_WORDS", "COPROC",
|
||||||
|
@@ -69,7 +69,7 @@ variableChars = upper <|> lower <|> digit <|> oneOf "_"
|
|||||||
functionChars = variableChars <|> oneOf ":+?-./^@"
|
functionChars = variableChars <|> oneOf ":+?-./^@"
|
||||||
-- Chars to allow in functions using the 'function' keyword
|
-- Chars to allow in functions using the 'function' keyword
|
||||||
extendedFunctionChars = functionChars <|> oneOf "[]*=!"
|
extendedFunctionChars = functionChars <|> oneOf "[]*=!"
|
||||||
specialVariable = oneOf "@*#?-$!"
|
specialVariable = oneOf (concat specialVariables)
|
||||||
paramSubSpecialChars = oneOf "/:+-=%"
|
paramSubSpecialChars = oneOf "/:+-=%"
|
||||||
quotableChars = "|&;<>()\\ '\t\n\r\xA0" ++ doubleQuotableChars
|
quotableChars = "|&;<>()\\ '\t\n\r\xA0" ++ doubleQuotableChars
|
||||||
quotable = almostSpace <|> oneOf quotableChars
|
quotable = almostSpace <|> oneOf quotableChars
|
||||||
|
Reference in New Issue
Block a user