feat(parser,ir,backend): Support array

This commit is contained in:
2026-05-31 22:06:09 +08:00
parent c42575c1c6
commit 669c415bd7
13 changed files with 575 additions and 130 deletions
+4 -2
View File
@@ -17,7 +17,7 @@ pub struct Lexer {
const WHITESPACE_CHARS: &[char] = &[' ', '\t', '\n', '\r'];
const DELIMITER_CHARS: &[char] = &[
'+', '-', '*', '/', '%', '=', '!', '<', '>', '(', ')', ',', ';', '{', '|', '&'
'+', '-', '*', '/', '%', '=', '!', '<', '>', '(', ')', '[', ']', ',', ';', '{', '|', '&'
];
struct Cursor {
chars: Vec<char>,
@@ -248,6 +248,8 @@ fn parse_delimiter(
')' => TokenValue::RParen,
'{' => TokenValue::LBrace,
'}' => TokenValue::RBrace,
'[' => TokenValue::LBracket,
']' => TokenValue::RBracket,
_ => return Err(LexParseError::NotMatched),
};
str_iter.advance(1);
@@ -398,4 +400,4 @@ mod tests {
fn test_expr() {
test_case("0-3,14-25");
}
}
}