147 [[nodiscard]]
const std::string &
text()
const
182 return type_ ==
type;
192 template <
typename... Types>
195 return ((type_ == types) || ...);
202 std::int64_t int_value_{0};
Represents a lexical token from C source code.
std::int64_t int_value() const
Returns the integer value for integer_literal tokens.
bool is(TokenType type) const
Checks if this token is of the specified type.
Token(TokenType type, std::string text, SourcePosition position)
Constructs a token with the given type, text, and position.
bool is_any_of(Types... types) const
Checks if this token is any of the specified types.
const SourcePosition & position() const
Returns the source position where the token starts.
Token(std::string text, std::int64_t int_value, SourcePosition position)
Constructs an integer literal token with a parsed value.
TokenType type() const
Returns the token type.
const std::string & text() const
Returns the raw text of the token.
void assert_or_panic(bool condition, const StringViewSourceLoc &s)
Conditionally panics if the given condition is false.
std::string token_type_name(TokenType type)
Returns a human-readable name for a token type.
TokenType
Enumeration of token types recognized by the C parser lexer.
Represents a position within source content.