Jai_Lexer module

check_for_keyword

procedureSource

Sets an identifier token's type to the keyword it spells, if any, and returns the type.

check_for_keyword :: (token: *J.Token) -> J.Token_Type

Parameters

token: *J.Token

Returns

Example↗
lexer: Lexer;
set_input_from_string(*lexer, "struct");
token := peek_next_token(*lexer);
assert(check_for_keyword(token) == .KEYWORD_STRUCT);