1use crate::parser::ast::{Expr, Item};
2
3pub const ENTRY_NAMES: &[&str] = &[
7 "start",
8 "main",
9 "启",
10 "เริ่ม",
11 "시작",
12 "начать",
13 "начало",
14 "inicio",
15 "comenzar",
16 "début",
17 "commencer",
18 "anfang",
19 "starten",
20 "início",
21 "शुरू",
22 "ابدأ",
23];
24
25pub fn entry_name(items: &[Item]) -> Option<String> {
29 for key in ENTRY_NAMES {
30 if items
31 .iter()
32 .any(|i| matches!(i, Item::Bind(n, _) if n == key))
33 {
34 return Some((*key).to_string());
35 }
36 }
37 items.iter().find_map(|i| match i {
38 Item::Bind(n, Expr::Do(_)) => Some(n.clone()),
39 _ => None,
40 })
41}