parse.Parser.parse no longer return itself

This commit is contained in:
Cheer Xiao 2014-01-28 12:01:30 +08:00
parent 5864354685
commit 33643163a3
2 changed files with 4 additions and 4 deletions

View File

@ -53,13 +53,13 @@ func main() {
}
p := parse.NewParser(name)
tree, pe := p.Parse(lr.Line, false)
pe := p.Parse(lr.Line, false)
if pe != nil {
fmt.Print(pe.(*util.ContextualError).Pprint())
continue
}
ee := ev.Eval(name, lr.Line, tree.Root)
ee := ev.Eval(name, lr.Line, p.Root)
if ee != nil {
fmt.Println(ee.(*util.ContextualError).Pprint())
continue

View File

@ -135,7 +135,7 @@ func (p *Parser) stopParse() {
// Parse parses the script to construct a representation of the script for
// execution.
func (p *Parser) Parse(text string, tab bool) (tree *Parser, err error) {
func (p *Parser) Parse(text string, tab bool) (err error) {
defer util.Recover(&err)
defer p.stopParse()
@ -147,7 +147,7 @@ func (p *Parser) Parse(text string, tab bool) (tree *Parser, err error) {
p.Root = p.parse()
p.stopParse()
return p, nil
return nil
}
// parse parses a chunk and ensures there are no trailing tokens