KCL: Support non-ASCII identifiers (#7525)

Both human and LLMs want to write KCL code in non-English languages. This is important and we should support it.

Note that errors are currently a bit broken with non-ASCII identifiers, see #4327
This commit is contained in:
Adam Chalmers
2025-06-19 09:10:21 -05:00
committed by GitHub
parent 9eaacc2a51
commit 9dd6e3e852
12 changed files with 655 additions and 11 deletions

View File

@ -3334,7 +3334,7 @@ mod tests {
use super::*;
use crate::{
parsing::ast::types::{BodyItem, Expr, VariableKind},
KclError, ModuleId,
ModuleId,
};
fn assert_reserved(word: &str) {
@ -4398,14 +4398,10 @@ secondExtrude = startSketchOn(XY)
#[test]
fn test_parse_parens_unicode() {
let result = crate::parsing::top_level_parse("");
let KclError::Lexical { details } = result.0.unwrap_err() else {
panic!();
};
// TODO: Better errors when program cannot tokenize.
let details = result.0.unwrap().1.pop().unwrap();
// TODO: Highlight where the unmatched open parenthesis is.
// https://github.com/KittyCAD/modeling-app/issues/696
assert_eq!(details.message, "found unknown token 'ޜ'");
assert_eq!(details.source_ranges[0].start(), 1);
assert_eq!(details.source_ranges[0].end(), 2);
assert_eq!(details.message, "Unexpected end of file. The compiler expected )");
}
#[test]