implement-modules #43
@ -60,8 +60,8 @@ func (this *Parser) expectDesc (description string, allowed ...lexer.TokenKind)
|
|||||||
|
|
||||||
// expectValue returns an error if the current token's value does not match the
|
// expectValue returns an error if the current token's value does not match the
|
||||||
// allowed values.
|
// allowed values.
|
||||||
func (this *Parser) expectValue (allowed ...string) error {
|
func (this *Parser) expectValue (kind lexer.TokenKind, allowed ...string) error {
|
||||||
if !this.token.ValueIs(allowed...) {
|
if !this.token.Is(kind) || !this.token.ValueIs(allowed...){
|
||||||
return errors.Errorf (
|
return errors.Errorf (
|
||||||
this.token.Position, "expected %s",
|
this.token.Position, "expected %s",
|
||||||
commaList(allowed))
|
commaList(allowed))
|
||||||
@ -71,8 +71,8 @@ func (this *Parser) expectValue (allowed ...string) error {
|
|||||||
|
|
||||||
// expectValueDesc is like expectValue, but the expected value(s) are described
|
// expectValueDesc is like expectValue, but the expected value(s) are described
|
||||||
// manually.
|
// manually.
|
||||||
func (this *Parser) expectValueDesc (description string, allowed ...string) error {
|
func (this *Parser) expectValueDesc (description string, kind lexer.TokenKind, allowed ...string) error {
|
||||||
if !this.token.ValueIs(allowed...) {
|
if !this.token.Is(kind) || !this.token.ValueIs(allowed...) {
|
||||||
return errors.Errorf (
|
return errors.Errorf (
|
||||||
this.token.Position, "expected %s",
|
this.token.Position, "expected %s",
|
||||||
description)
|
description)
|
||||||
|
Loading…
Reference in New Issue
Block a user