fix: add Char pattern matching and Char comparison operators
- Parser: support Char literals in match patterns (e.g., 'x' => ...) - Interpreter: add Char comparison for <, <=, >, >= operators Previously only Int, Float, and String supported ordering comparisons. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1887,6 +1887,14 @@ impl Parser {
|
||||
span: token.span,
|
||||
}))
|
||||
}
|
||||
TokenKind::Char(c) => {
|
||||
let c = *c;
|
||||
self.advance();
|
||||
Ok(Pattern::Literal(Literal {
|
||||
kind: LiteralKind::Char(c),
|
||||
span: token.span,
|
||||
}))
|
||||
}
|
||||
TokenKind::Ident(name) => {
|
||||
// Check if it starts with uppercase (constructor) or lowercase (variable)
|
||||
if name.chars().next().map_or(false, |c| c.is_uppercase()) {
|
||||
|
||||
Reference in New Issue
Block a user