match_word

Macro match_word 

Source
macro_rules! match_word {
    ($word:expr, $token_type:ty, $token_value:expr, $rule_name:ident) => { ... };
}
Expand description

Creates a lexer rule that matches a specific word. Words are the sequences of strings that are separated by a space.

For example, if we want to match the word "let" (specifically "let" followed by either a space or EOF) in the string "let x = 10;", we should use this macro.

ยงUsage

use runic_kit::lexer::utils::match_word;

match_word!("let", String, "let".to_string(), LetRule);