mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
Fix parsing of assignment forms and the = builtin.
This commit is contained in:
parent
ddb7396046
commit
c5c5a7ddcd
|
@ -147,7 +147,9 @@ func (fn *Form) parse(ps *parser, cut runePred) {
|
|||
parseSpaces(fn, ps)
|
||||
}
|
||||
if !startsCompound(ps.peek(), cut) {
|
||||
if len(fn.Assignments) == 0 {
|
||||
if len(fn.Assignments) > 0 {
|
||||
return
|
||||
} else {
|
||||
ps.error(shouldBeCompound)
|
||||
}
|
||||
}
|
||||
|
@ -192,6 +194,10 @@ loop:
|
|||
// assignment to fn.Assignments and returns true. Otherwise it rewinds the
|
||||
// parser and returns false.
|
||||
func (fn *Form) tryAssignment(ps *parser, cut runePred) bool {
|
||||
if !startsIndexing(ps.peek(), cut) || ps.peek() == '=' {
|
||||
return false
|
||||
}
|
||||
|
||||
begin := ps.pos
|
||||
var ok bool
|
||||
an := parseAssignment(ps, cut, &ok)
|
||||
|
|
Loading…
Reference in New Issue
Block a user