master
Jordan Orelli 10 years ago
parent 11e332968f
commit 213561bc59

@ -68,9 +68,14 @@ func (p *parser) parseValue() (interface{}, error) {
case t_string:
return t.s, nil
case t_list_start:
l := new(list)
return p.parseList(new(list))
default:
return nil, fmt.Errorf("parse error: unexpected %v token while looking for value", t.t)
}
}
}
SIN:
func (p *parser) parseList(l *list) (*list, error) {
if p.peek().t == t_list_end {
p.next()
return l, nil
@ -84,14 +89,10 @@ func (p *parser) parseValue() (interface{}, error) {
switch t := p.next(); t.t {
case t_list_separator:
goto SIN
return p.parseList(l)
case t_list_end:
return l, nil
default:
return nil, fmt.Errorf("parse error: unexpected %v token while scanning for list", t.t)
}
default:
return nil, fmt.Errorf("parse error: unexpected %v token while looking for value", t.t)
}
}
}

Loading…
Cancel
Save