expect method

void expect(
  1. String text, {
  2. bool consume = true,
})

Implementation

void expect(String text, {bool consume = true}) {
  if (this.fetch().text != text) {
    throw ParseException(
        'Expected \'$text\', got \'${this.fetch().text}\'', this.fetch());
  }
  if (consume) {
    this.consume();
  }
}