* Checks a result to make sure it has the right type, and throws an * appropriate error otherwise.
(text, consume)
| 14917 | |
| 14918 | |
| 14919 | expect(text, consume) { |
| 14920 | if (consume === void 0) { |
| 14921 | consume = true; |
| 14922 | } |
| 14923 | |
| 14924 | if (this.nextToken.text !== text) { |
| 14925 | throw new ParseError("Expected '" + text + "', got '" + this.nextToken.text + "'", this.nextToken); |
| 14926 | } |
| 14927 | |
| 14928 | if (consume) { |
| 14929 | this.consume(); |
| 14930 | } |
| 14931 | } |
| 14932 | /** |
| 14933 | * Considers the current look ahead token as consumed, |
| 14934 | * and fetches the one after that as the new look ahead. |
no test coverage detected