reader/wgsl: Remove old token methods.
This CL removes the old token `Is<Name>()` methods which are no longer
being used in the parser or lexer. (Some of them were used in tests but
the generic `Is(<type>)` is used instead.
New `peek` methods are added which will peek if the given token comes
either next or at the given index.
Change-Id: I8d15f2a42889f981d273b6459d20c4202db1ae32
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57540
Auto-Submit: dan sinclair <dan.sinclair@gmail.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
diff --git a/src/reader/wgsl/parser_impl.h b/src/reader/wgsl/parser_impl.h
index 78192aa..fb1f16f 100644
--- a/src/reader/wgsl/parser_impl.h
+++ b/src/reader/wgsl/parser_impl.h
@@ -336,12 +336,16 @@
/// @returns the next token
Token next();
- /// @returns the next token without advancing
- Token peek();
- /// Peeks ahead and returns the token at `idx` head of the current position
+ /// Peeks ahead and returns the token at `idx` ahead of the current position
/// @param idx the index of the token to return
/// @returns the token `idx` positions ahead without advancing
- Token peek(size_t idx);
+ Token peek(size_t idx = 0);
+ /// Peeks ahead and returns true if the token at `idx` ahead of the current
+ /// position is |tok|
+ /// @param idx the index of the token to return
+ /// @param tok the token to look for
+ /// @returns true if the token `idx` positions ahead is |tok|
+ bool peek_is(Token::Type tok, size_t idx = 0);
/// @returns the last token that was returned by `next()`
Token last_token() const;
/// Appends an error at `t` with the message `msg`