Browse Source

make sure to always parse the tokens that are needed

pull/16/head
Brett Langdon 11 years ago
parent
commit
da7c4ded96
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      parser/parser.go

+ 4
- 0
parser/parser.go View File

@ -178,6 +178,7 @@ func (this *Parser) parseSetting(name string) error {
msg := fmt.Sprintf("expected ';' instead found '%s'", this.cur_tok.Literal) msg := fmt.Sprintf("expected ';' instead found '%s'", this.cur_tok.Literal)
return this.SyntaxError(msg) return this.SyntaxError(msg)
} }
this.readToken()
this.cur_section.Set(name, value) this.cur_section.Set(name, value)
return nil return nil
@ -221,6 +222,7 @@ func (this *Parser) Parse() error {
if err != nil { if err != nil {
return err return err
} }
this.readToken()
} else if this.cur_tok.ID == token.EQUAL { } else if this.cur_tok.ID == token.EQUAL {
err := this.parseSetting(tok.Literal) err := this.parseSetting(tok.Literal)
if err != nil { if err != nil {
@ -232,6 +234,8 @@ func (this *Parser) Parse() error {
if err != nil { if err != nil {
return err return err
} }
default:
return this.SyntaxError(fmt.Sprintf("unexpected token %s", tok))
} }
} }
return nil return nil


Loading…
Cancel
Save