|
|
@ -104,13 +104,12 @@ func (p *parser) parseList(l list) (list, error) {
|
|
|
|
l = append(l, v)
|
|
|
|
l = append(l, v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch t := p.next(); t.t {
|
|
|
|
switch t := p.peek(); t.t {
|
|
|
|
case t_list_separator:
|
|
|
|
|
|
|
|
return p.parseList(l)
|
|
|
|
|
|
|
|
case t_list_end:
|
|
|
|
case t_list_end:
|
|
|
|
|
|
|
|
p.next()
|
|
|
|
return l, nil
|
|
|
|
return l, nil
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return nil, fmt.Errorf("parse error: unexpected %v token while scanning for list", t.t)
|
|
|
|
return p.parseList(l)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -134,13 +133,12 @@ func (p *parser) parseObject(obj object) (object, error) {
|
|
|
|
obj[field_name] = v
|
|
|
|
obj[field_name] = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch t := p.next(); t.t {
|
|
|
|
switch t := p.peek(); t.t {
|
|
|
|
case t_list_separator:
|
|
|
|
|
|
|
|
return p.parseObject(obj)
|
|
|
|
|
|
|
|
case t_object_end:
|
|
|
|
case t_object_end:
|
|
|
|
|
|
|
|
p.next()
|
|
|
|
return obj, nil
|
|
|
|
return obj, nil
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return nil, fmt.Errorf("parse error: unexpected %v token while scanning for object", t.t)
|
|
|
|
return p.parseObject(obj)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|