implement-modules #43

Closed
sashakoshka wants to merge 502 commits from implement-modules into main
Showing only changes of commit 79f51ce4c6 - Show all commits

View File

@ -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)