devalang_core/core/parser/handler/identifier/
mod.rs1pub mod automate;
2pub mod call;
3pub mod emit;
4pub mod function;
5pub mod group;
6pub mod let_;
7pub mod on;
8pub mod print;
9pub mod sleep;
10pub mod spawn;
11pub mod synth;
12
13use crate::core::{
14 parser::{
15 driver::Parser,
16 handler::identifier::{
17 automate::parse_automate_token, call::parse_call_token, emit::parse_emit_token,
18 group::parse_group_token, let_::parse_let_token, on::parse_on_token,
19 print::parse_print_token, sleep::parse_sleep_token, spawn::parse_spawn_token,
20 synth::parse_synth_token,
21 },
22 statement::Statement,
23 },
24 store::global::GlobalStore,
25};
26
27pub fn parse_identifier_token(parser: &mut Parser, global_store: &mut GlobalStore) -> Statement {
28 let Some(current_token) = parser.peek_clone() else {
29 return Statement::unknown();
30 };
31
32 let current_token_clone = current_token.clone();
33 let current_token_lexeme = current_token_clone.lexeme.clone();
34
35 match current_token_lexeme.as_str() {
36 "let" => parse_let_token(parser, current_token_clone, global_store),
37 "group" => parse_group_token(parser, current_token_clone, global_store),
38 "call" => parse_call_token(parser, current_token_clone, global_store),
39 "spawn" => parse_spawn_token(parser, current_token_clone, global_store),
40 "sleep" => parse_sleep_token(parser, current_token_clone, global_store),
41 "synth" => parse_synth_token(parser, current_token_clone, global_store),
42 "automate" => parse_automate_token(parser, current_token_clone, global_store),
43 "print" => parse_print_token(parser, current_token_clone, global_store),
44 "on" => parse_on_token(parser, global_store),
45 "emit" => parse_emit_token(parser, current_token_clone, global_store),
46 _ => {
47 parser.advance(); crate::core::parser::statement::error_from_token(
50 current_token_clone,
51 "Unexpected identifier".to_string(),
52 )
53 }
54 }
55}