parser.go: square brackets are also allowed after a variable

This commit is contained in:
Celestino Amoroso 2024-05-25 03:32:13 +02:00
parent 76dd01afcd
commit fa136cb70b

View File

@ -407,7 +407,7 @@ func (self *parser) parseGeneral(scanner *scanner, allowForest bool, allowVarRef
if currentTerm != nil { if currentTerm != nil {
sym = currentTerm.symbol() sym = currentTerm.symbol()
} }
if sym == SymList || sym == SymString || sym == SymDict || sym == SymExpression { if sym == SymList || sym == SymString || sym == SymDict || sym == SymExpression || sym == SymVariable {
indexTk := NewToken(listTerm.tk.row, listTerm.tk.col, SymIndex, listTerm.source()) indexTk := NewToken(listTerm.tk.row, listTerm.tk.col, SymIndex, listTerm.source())
indexTerm := newTerm(indexTk) indexTerm := newTerm(indexTk)
if err = tree.addTerm(indexTerm); err == nil { if err = tree.addTerm(indexTerm); err == nil {