Expressions: support ${my var} syntax (#29819)

This commit is contained in:
Kyle Brandt
2020-12-14 14:21:16 -05:00
committed by GitHub
parent e7447c5067
commit c6b11a8f90
4 changed files with 38 additions and 7 deletions

View File

@ -300,8 +300,9 @@ func (t *Tree) v() Node {
func (t *Tree) Var() (v *VarNode) {
token := t.next()
varNoPrefix := strings.TrimPrefix(token.val, "$")
t.VarNames = append(t.VarNames, varNoPrefix)
return newVar(token.pos, varNoPrefix, token.val)
varNoBraces := strings.TrimSuffix(strings.TrimPrefix(varNoPrefix, "{"), "}")
t.VarNames = append(t.VarNames, varNoBraces)
return newVar(token.pos, varNoBraces, token.val)
}
// Func parses a FuncNode.