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
|
||||
// allowed values.
|
||||
func (this *Parser) expectValue (allowed ...string) error {
|
||||
if !this.token.ValueIs(allowed...) {
|
||||
func (this *Parser) expectValue (kind lexer.TokenKind, allowed ...string) error {
|
||||
if !this.token.Is(kind) || !this.token.ValueIs(allowed...){
|
||||
return errors.Errorf (
|
||||
this.token.Position, "expected %s",
|
||||
commaList(allowed))
|
||||
@ -71,8 +71,8 @@ func (this *Parser) expectValue (allowed ...string) error {
|
||||
|
||||
// expectValueDesc is like expectValue, but the expected value(s) are described
|
||||
// manually.
|
||||
func (this *Parser) expectValueDesc (description string, allowed ...string) error {
|
||||
if !this.token.ValueIs(allowed...) {
|
||||
func (this *Parser) expectValueDesc (description string, kind lexer.TokenKind, allowed ...string) error {
|
||||
if !this.token.Is(kind) || !this.token.ValueIs(allowed...) {
|
||||
return errors.Errorf (
|
||||
this.token.Position, "expected %s",
|
||||
description)
|
||||
|
Loading…
Reference in New Issue
Block a user