Merge pull request #1898 from josephcsible/nameexpansion
Simplify nameExpansion
This commit is contained in:
commit
f8c1ffb0dc
|
@ -840,10 +840,9 @@ getBracedReference s = fromMaybe s $
|
||||||
if c `elem` "*@#?-$!" then return [c] else fail "not special"
|
if c `elem` "*@#?-$!" then return [c] else fail "not special"
|
||||||
getSpecial _ = fail "empty"
|
getSpecial _ = fail "empty"
|
||||||
|
|
||||||
nameExpansion ('!':rest) = do -- e.g. ${!foo*bar*}
|
nameExpansion ('!':next:rest) = do -- e.g. ${!foo*bar*}
|
||||||
let suffix = dropWhile isVariableChar rest
|
guard $ isVariableChar next -- e.g. ${!@}
|
||||||
guard $ suffix /= rest -- e.g. ${!@}
|
first <- find (not . isVariableChar) rest
|
||||||
first <- suffix !!! 0
|
|
||||||
guard $ first `elem` "*?"
|
guard $ first `elem` "*?"
|
||||||
return ""
|
return ""
|
||||||
nameExpansion _ = Nothing
|
nameExpansion _ = Nothing
|
||||||
|
|
Loading…
Reference in New Issue