added tables to the execution part

This commit is contained in:
afonya2 2025-06-03 19:39:17 +02:00
parent 6caafe77d0
commit 4faabe0d9c
Signed by: afonya
GPG key ID: EBB9C4CAFAAFB2DC
3 changed files with 182 additions and 9 deletions

View file

@ -341,6 +341,15 @@ fn read_table(input: &Vec<Token>, pos: &mut usize) -> ASTPart {
if input[*pos].typ == TokenType::SEPARATOR && input[*pos].value == "[" {
*pos += 1;
let keyy = read_exp(pos, input, &key_ends, &key_ends);
match keyy {
ASTPart::Table(_) => {
panic!("Table keys cannot be tables at {}", input[*pos].pos);
},
ASTPart::Function(_) => {
panic!("Table keys cannot be functions at {}", input[*pos].pos);
},
_ => {}
}
if input[*pos].typ != TokenType::SEPARATOR || input[*pos].value != "]" {
panic!("Unexpected end of key at {}", input[*pos].pos);
}