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