From b4ee7e4ddafdf459f7c45a7004fa0ed4caabdfe7 Mon Sep 17 00:00:00 2001 From: He1pa <18012015693@163.com> Date: Fri, 14 Jul 2023 15:11:00 +0800 Subject: [PATCH] feat: add position for each name in identifier --- kclvm/ast/src/ast.rs | 19 ++- kclvm/ast/src/path.rs | 2 +- kclvm/ast/src/tests.rs | 25 +-- kclvm/ast_pretty/src/node.rs | 2 +- kclvm/compiler/src/codegen/llvm/module.rs | 2 +- kclvm/compiler/src/codegen/llvm/node.rs | 48 +++--- kclvm/compiler/src/codegen/llvm/schema.rs | 8 +- kclvm/parser/src/parser/expr.rs | 36 +++- kclvm/parser/src/parser/stmt.rs | 20 +-- kclvm/parser/src/parser/tests.rs | 156 +++++++++--------- ...rror_recovery__assert_stmt_recovery_1.snap | 19 ++- ...rror_recovery__assert_stmt_recovery_3.snap | 19 ++- ...rror_recovery__assign_stmt_recovery_0.snap | 9 +- ...rror_recovery__assign_stmt_recovery_2.snap | 9 +- ...rror_recovery__assign_stmt_recovery_3.snap | 19 ++- ...rror_recovery__assign_stmt_recovery_5.snap | 18 +- ...rror_recovery__assign_stmt_recovery_6.snap | 28 +++- ...ts__error_recovery__binary_recovery_0.snap | 10 +- ...ts__error_recovery__binary_recovery_1.snap | 19 ++- ...ts__error_recovery__binary_recovery_2.snap | 10 +- ...ts__error_recovery__binary_recovery_3.snap | 10 +- ...ts__error_recovery__binary_recovery_4.snap | 19 ++- ...ts__error_recovery__binary_recovery_5.snap | 19 ++- ...ts__error_recovery__binary_recovery_6.snap | 18 +- ...ts__error_recovery__binary_recovery_7.snap | 19 ++- ...ts__error_recovery__binary_recovery_8.snap | 10 +- ...ests__error_recovery__call_recovery_0.snap | 9 +- ...ests__error_recovery__call_recovery_1.snap | 10 +- ...ests__error_recovery__call_recovery_2.snap | 18 +- ...ests__error_recovery__call_recovery_3.snap | 28 +++- ...ests__error_recovery__call_recovery_4.snap | 28 +++- ...ests__error_recovery__call_recovery_5.snap | 10 +- ...ests__error_recovery__call_recovery_6.snap | 10 +- ...ests__error_recovery__call_recovery_7.snap | 19 ++- ...rror_recovery__comp_clause_recovery_0.snap | 19 ++- ...rror_recovery__comp_clause_recovery_1.snap | 19 ++- ...rror_recovery__comp_clause_recovery_3.snap | 19 ++- ...rror_recovery__comp_clause_recovery_4.snap | 28 +++- ...rror_recovery__comp_clause_recovery_5.snap | 28 +++- ...s__error_recovery__compare_recovery_0.snap | 18 +- ...s__error_recovery__compare_recovery_1.snap | 19 ++- ...s__error_recovery__compare_recovery_2.snap | 19 ++- ...s__error_recovery__compare_recovery_3.snap | 18 +- ...s__error_recovery__compare_recovery_4.snap | 18 +- ...s__error_recovery__compare_recovery_5.snap | 19 ++- ...s__error_recovery__compare_recovery_6.snap | 19 ++- ...ts__error_recovery__config_recovery_1.snap | 10 +- ...s__error_recovery__config_recovery_10.snap | 18 +- ...s__error_recovery__config_recovery_11.snap | 19 ++- ...s__error_recovery__config_recovery_12.snap | 19 ++- ...s__error_recovery__config_recovery_13.snap | 10 +- ...s__error_recovery__config_recovery_14.snap | 10 +- ...ts__error_recovery__config_recovery_2.snap | 19 ++- ...ts__error_recovery__config_recovery_3.snap | 19 ++- ...ts__error_recovery__config_recovery_4.snap | 19 ++- ...ts__error_recovery__config_recovery_5.snap | 19 ++- ...ts__error_recovery__config_recovery_6.snap | 19 ++- ...ts__error_recovery__config_recovery_7.snap | 18 +- ...ts__error_recovery__config_recovery_8.snap | 19 ++- ...ts__error_recovery__config_recovery_9.snap | 18 +- ..._tests__error_recovery__if_recovery_4.snap | 10 +- ...s__error_recovery__if_stmt_recovery_1.snap | 19 ++- ...s__error_recovery__if_stmt_recovery_2.snap | 9 +- ...s__error_recovery__if_stmt_recovery_3.snap | 9 +- ...s__error_recovery__if_stmt_recovery_4.snap | 19 ++- ...s__error_recovery__if_stmt_recovery_6.snap | 10 +- ...or_recovery__joined_string_recovery_1.snap | 10 +- ...or_recovery__joined_string_recovery_2.snap | 10 +- ...or_recovery__joined_string_recovery_5.snap | 10 +- ...or_recovery__joined_string_recovery_6.snap | 10 +- ...sts__error_recovery__list_recovery_10.snap | 18 +- ...sts__error_recovery__list_recovery_11.snap | 21 ++- ...sts__error_recovery__list_recovery_12.snap | 18 +- ...ests__error_recovery__list_recovery_9.snap | 18 +- ...sts__error_recovery__paren_recovery_0.snap | 10 +- ...sts__error_recovery__paren_recovery_1.snap | 10 +- ...sts__error_recovery__paren_recovery_4.snap | 10 +- ...sts__error_recovery__paren_recovery_5.snap | 9 +- ...ts__error_recovery__schema_recovery_0.snap | 10 +- ...ts__error_recovery__schema_recovery_1.snap | 19 ++- ...ts__error_recovery__schema_recovery_2.snap | 19 ++- ...ts__error_recovery__schema_recovery_3.snap | 19 ++- ...ts__error_recovery__schema_recovery_4.snap | 28 +++- ...ts__error_recovery__schema_recovery_5.snap | 19 ++- ...ts__error_recovery__schema_recovery_6.snap | 19 ++- ...ror_recovery__schema_stmt_recovery_14.snap | 19 ++- ...ror_recovery__schema_stmt_recovery_15.snap | 18 +- ...ror_recovery__schema_stmt_recovery_16.snap | 18 +- ...ror_recovery__schema_stmt_recovery_19.snap | 10 +- ...ror_recovery__schema_stmt_recovery_20.snap | 9 +- ...ror_recovery__schema_stmt_recovery_21.snap | 9 +- ...ror_recovery__schema_stmt_recovery_22.snap | 19 ++- ...ror_recovery__schema_stmt_recovery_23.snap | 18 +- ...ror_recovery__schema_stmt_recovery_24.snap | 9 +- ...ror_recovery__schema_stmt_recovery_27.snap | 10 +- ...ror_recovery__schema_stmt_recovery_28.snap | 10 +- ...ror_recovery__schema_stmt_recovery_30.snap | 10 +- ...rror_recovery__schema_stmt_recovery_4.snap | 10 +- ...rror_recovery__schema_stmt_recovery_5.snap | 10 +- ...rror_recovery__schema_stmt_recovery_6.snap | 10 +- ...rror_recovery__schema_stmt_recovery_7.snap | 10 +- ...rror_recovery__schema_stmt_recovery_8.snap | 9 +- ...ts__error_recovery__select_recovery_0.snap | 19 ++- ...ts__error_recovery__select_recovery_1.snap | 28 +++- ...s__error_recovery__select_recovery_10.snap | 19 ++- ...s__error_recovery__select_recovery_11.snap | 28 +++- ...s__error_recovery__select_recovery_12.snap | 19 ++- ...s__error_recovery__select_recovery_13.snap | 28 +++- ...s__error_recovery__select_recovery_14.snap | 10 +- ...ts__error_recovery__select_recovery_2.snap | 37 ++++- ...ts__error_recovery__select_recovery_3.snap | 10 +- ...ts__error_recovery__select_recovery_4.snap | 10 +- ...ts__error_recovery__select_recovery_5.snap | 19 ++- ...ts__error_recovery__select_recovery_6.snap | 19 ++- ...ts__error_recovery__select_recovery_7.snap | 28 +++- ...ts__error_recovery__select_recovery_8.snap | 37 ++++- ...ts__error_recovery__select_recovery_9.snap | 10 +- ..._error_recovery__subscript_recovery_0.snap | 10 +- ..._error_recovery__subscript_recovery_1.snap | 10 +- ...error_recovery__subscript_recovery_10.snap | 10 +- ...error_recovery__subscript_recovery_12.snap | 10 +- ..._error_recovery__subscript_recovery_2.snap | 19 ++- ..._error_recovery__subscript_recovery_3.snap | 10 +- ..._error_recovery__subscript_recovery_4.snap | 10 +- ..._error_recovery__subscript_recovery_5.snap | 10 +- ..._error_recovery__subscript_recovery_6.snap | 28 +++- ...error_recovery__type_alias_recovery_2.snap | 19 ++- ...error_recovery__type_alias_recovery_5.snap | 10 +- ...error_recovery__type_alias_recovery_6.snap | 10 +- ...sts__error_recovery__unary_recovery_0.snap | 10 +- ...sts__error_recovery__unary_recovery_2.snap | 10 +- ...sts__error_recovery__unary_recovery_3.snap | 10 +- ...sts__error_recovery__unary_recovery_5.snap | 9 +- ...sts__error_recovery__unary_recovery_6.snap | 9 +- ...sts__error_recovery__unary_recovery_7.snap | 9 +- kclvm/parser/testdata/assert-02.k.json | 2 +- kclvm/parser/testdata/assert-03.k.json | 2 +- kclvm/parser/testdata/assert-if-0.k.json | 2 +- kclvm/parser/testdata/assert-if-1.k.json | 2 +- kclvm/parser/testdata/assert-if-2.k.json | 2 +- kclvm/parser/testdata/assign-01.k.json | 2 +- kclvm/parser/testdata/config_expr-01.k.json | 2 +- kclvm/parser/testdata/config_expr-02.k.json | 2 +- kclvm/parser/testdata/config_expr-03.k.json | 2 +- kclvm/parser/testdata/config_expr-04.k.json | 2 +- kclvm/parser/testdata/hello_win.k.json | 2 +- kclvm/parser/testdata/if-01.k.json | 2 +- kclvm/parser/testdata/if-02.k.json | 2 +- kclvm/parser/testdata/if-03.k.json | 2 +- kclvm/parser/testdata/type-01.k.json | 2 +- kclvm/query/src/override.rs | 14 +- kclvm/query/src/tests.rs | 2 +- kclvm/sema/src/pre_process/config.rs | 4 +- kclvm/sema/src/pre_process/identifier.rs | 20 ++- kclvm/sema/src/pre_process/tests.rs | 4 +- kclvm/sema/src/resolver/arg.rs | 2 +- kclvm/sema/src/resolver/config.rs | 10 +- kclvm/sema/src/resolver/global.rs | 6 +- kclvm/sema/src/resolver/node.rs | 19 ++- kclvm/sema/src/resolver/schema.rs | 2 +- kclvm/sema/src/resolver/tests.rs | 2 +- kclvm/sema/src/resolver/ty_alias.rs | 15 +- kclvm/tools/src/LSP/src/goto_def.rs | 8 +- kclvm/tools/src/LSP/src/util.rs | 48 +++++- kclvm/tools/src/vet/expr_builder.rs | 4 +- .../vet/test_datas/json/complex.k.ast.json | 9 +- .../src/vet/test_datas/json/list.k.ast.json | 9 +- .../test_datas/json/only_with_bool.ast.json | 9 +- .../test_datas/json/only_with_float.ast.json | 9 +- .../test_datas/json/only_with_null.ast.json | 9 +- .../src/vet/test_datas/json/simple.k.ast.json | 9 +- .../src/vet/test_datas/json/test.k.ast.json | 9 +- .../vet/test_datas/yaml/complex.k.ast.yaml | 7 +- .../src/vet/test_datas/yaml/list.k.ast.yaml | 9 +- .../test_datas/yaml/only_with_bool.ast.yaml | 7 +- .../test_datas/yaml/only_with_float.ast.yaml | 9 +- .../test_datas/yaml/only_with_null.ast.yaml | 7 +- .../src/vet/test_datas/yaml/simple.k.ast.yaml | 7 +- .../src/vet/test_datas/yaml/test.k.ast.yaml | 7 +- kclvm/tools/src/vet/validator.rs | 2 +- 180 files changed, 2068 insertions(+), 529 deletions(-) diff --git a/kclvm/ast/src/ast.rs b/kclvm/ast/src/ast.rs index 67de11e41..ee7f0b4b9 100644 --- a/kclvm/ast/src/ast.rs +++ b/kclvm/ast/src/ast.rs @@ -492,7 +492,7 @@ impl SchemaStmt { attr_list.push(( unification_stmt.target.line, unification_stmt.target.column, - unification_stmt.target.node.names[0].to_string(), + unification_stmt.target.node.names[0].node.to_string(), )); } Stmt::Assign(assign_stmt) => { @@ -501,7 +501,7 @@ impl SchemaStmt { attr_list.push(( target.line, target.column, - target.node.names[0].to_string(), + target.node.names[0].node.to_string(), )); } } @@ -511,7 +511,7 @@ impl SchemaStmt { attr_list.push(( aug_assign_stmt.target.line, aug_assign_stmt.target.column, - aug_assign_stmt.target.node.names[0].to_string(), + aug_assign_stmt.target.node.names[0].node.to_string(), )); } } @@ -642,14 +642,21 @@ pub enum Expr { /// ``` #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Identifier { - pub names: Vec, + pub names: Vec>, pub pkgpath: String, pub ctx: ExprContext, } impl Identifier { pub fn get_name(&self) -> String { - self.names.join(".") + self.get_names().join(".") + } + + pub fn get_names(&self) -> Vec { + self.names + .iter() + .map(|node| node.node.clone()) + .collect::>() } } @@ -1512,7 +1519,7 @@ impl ToString for Type { match typ { Type::Any => w.push_str("any"), Type::Named(x) => { - w.push_str(&x.names.join(".")); + w.push_str(&x.get_name()); } Type::Basic(x) => { w.push_str(match x { diff --git a/kclvm/ast/src/path.rs b/kclvm/ast/src/path.rs index d41fcf8f8..f3c3043d2 100644 --- a/kclvm/ast/src/path.rs +++ b/kclvm/ast/src/path.rs @@ -10,7 +10,7 @@ use crate::ast; /// use kclvm_ast::path::get_key_path; /// /// let ident = Some(Box::new(ast::Node::dummy_node(ast::Expr::Identifier(ast::Identifier { -/// names: vec!["alice".to_string()], +/// names: vec![ast::Node::dummy_node("alice".to_string())], /// pkgpath: "".to_string(), /// ctx: ast::ExprContext::Load, /// })))); diff --git a/kclvm/ast/src/tests.rs b/kclvm/ast/src/tests.rs index 3a389728e..fd79d1aaa 100644 --- a/kclvm/ast/src/tests.rs +++ b/kclvm/ast/src/tests.rs @@ -5,7 +5,7 @@ use crate::{ast, ast::*}; /// Construct an AssignStmt node with assign_value as value fn build_assign_node(attr_name: &str, assign_value: NodeRef) -> NodeRef { let iden = node_ref!(Identifier { - names: vec![attr_name.to_string()], + names: vec![Node::dummy_node(attr_name.to_string())], pkgpath: String::new(), ctx: ExprContext::Store }); @@ -28,7 +28,7 @@ fn get_dummy_assign_ast() -> ast::Node { ast::AssignStmt { targets: vec![Box::new(ast::Node::new( ast::Identifier { - names: vec![String::from("a")], + names: vec![Node::dummy_node(String::from("a"))], pkgpath: String::from(filename), ctx: ast::ExprContext::Load, }, @@ -71,7 +71,7 @@ fn get_dummy_assign_binary_ast() -> ast::Node { ast::AssignStmt { targets: vec![Box::new(ast::Node::new( ast::Identifier { - names: vec![String::from("a")], + names: vec![Node::dummy_node(String::from("a"))], pkgpath: String::from(filename), ctx: ast::ExprContext::Load, }, @@ -86,7 +86,7 @@ fn get_dummy_assign_binary_ast() -> ast::Node { op: ast::BinOrCmpOp::Bin(ast::BinOp::Add), left: Box::new(ast::Node::new( ast::Expr::Identifier(ast::Identifier { - names: vec![String::from("a")], + names: vec![Node::dummy_node(String::from("a"))], pkgpath: String::from(filename), ctx: ast::ExprContext::Load, }), @@ -98,7 +98,7 @@ fn get_dummy_assign_binary_ast() -> ast::Node { )), right: Box::new(ast::Node::new( ast::Expr::Identifier(ast::Identifier { - names: vec![String::from("a")], + names: vec![Node::dummy_node(String::from("a"))], pkgpath: String::from(filename), ctx: ast::ExprContext::Load, }), @@ -147,15 +147,15 @@ fn test_mut_walker() { pub struct VarMutSelfMutWalker; impl<'ctx> MutSelfMutWalker<'ctx> for VarMutSelfMutWalker { fn walk_identifier(&mut self, identifier: &'ctx mut ast::Identifier) { - if identifier.names[0] == "a" { + if identifier.names[0].node == "a" { let id_mut = identifier.names.get_mut(0).unwrap(); - *id_mut = "x".to_string(); + id_mut.node = "x".to_string(); } } } let mut assign_stmt = get_dummy_assign_ast(); VarMutSelfMutWalker {}.walk_assign_stmt(&mut assign_stmt.node); - assert_eq!(assign_stmt.node.targets[0].node.names[0], "x") + assert_eq!(assign_stmt.node.targets[0].node.names[0].node, "x") } #[test] @@ -235,7 +235,10 @@ fn test_filter_schema_with_mult_schema() { #[test] fn test_build_assign_stmt() { let test_expr = node_ref!(ast::Expr::Identifier(Identifier { - names: vec!["name1".to_string(), "name2".to_string()], + names: vec![ + Node::dummy_node("name1".to_string()), + Node::dummy_node("name2".to_string()) + ], pkgpath: "test".to_string(), ctx: ast::ExprContext::Load })); @@ -244,8 +247,8 @@ fn test_build_assign_stmt() { if let ast::Stmt::Assign(ref assign) = assgin_stmt.node { if let ast::Expr::Identifier(ref iden) = &assign.value.node { assert_eq!(iden.names.len(), 2); - assert_eq!(iden.names[0], "name1".to_string()); - assert_eq!(iden.names[1], "name2".to_string()); + assert_eq!(iden.names[0].node, "name1".to_string()); + assert_eq!(iden.names[1].node, "name2".to_string()); assert_eq!(iden.pkgpath, "test".to_string()); match iden.ctx { ast::ExprContext::Load => {} diff --git a/kclvm/ast_pretty/src/node.rs b/kclvm/ast_pretty/src/node.rs index efecaab25..091ba7b92 100644 --- a/kclvm/ast_pretty/src/node.rs +++ b/kclvm/ast_pretty/src/node.rs @@ -852,7 +852,7 @@ impl<'p> Printer<'p> { let names = &identifier.names; let re = fancy_regex::Regex::new(IDENTIFIER_REGEX).unwrap(); - let need_right_brace = !names.iter().all(|n| re.is_match(n).unwrap_or(false)); + let need_right_brace = !names.iter().all(|n| re.is_match(&n.node).unwrap_or(false)); let count = if need_right_brace { self.write( &names diff --git a/kclvm/compiler/src/codegen/llvm/module.rs b/kclvm/compiler/src/codegen/llvm/module.rs index b1339374d..056200baa 100644 --- a/kclvm/compiler/src/codegen/llvm/module.rs +++ b/kclvm/compiler/src/codegen/llvm/module.rs @@ -46,7 +46,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { for target in &assign_stmt.targets { let names = &target.node.names; if names.len() == 1 { - self.add_or_update_global_variable(&names[0], self.undefined_value()); + self.add_or_update_global_variable(&names[0].node, self.undefined_value()); } } } diff --git a/kclvm/compiler/src/codegen/llvm/node.rs b/kclvm/compiler/src/codegen/llvm/node.rs index 23398cc5f..b96950bc3 100644 --- a/kclvm/compiler/src/codegen/llvm/node.rs +++ b/kclvm/compiler/src/codegen/llvm/node.rs @@ -72,7 +72,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { fn walk_unification_stmt(&self, unification_stmt: &'ctx ast::UnificationStmt) -> Self::Result { check_backtrack_stop!(self); self.local_vars.borrow_mut().clear(); - let name = &unification_stmt.target.node.names[0]; + let name = &unification_stmt.target.node.names[0].node; self.target_vars.borrow_mut().push(name.clone()); // The right value of the unification_stmt is a schema_expr. let value = self @@ -147,7 +147,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { for name in &assign_stmt.targets { self.target_vars .borrow_mut() - .push(name.node.names[0].clone()); + .push(name.node.names[0].node.clone()); } // Load the right value let mut value = self @@ -181,7 +181,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { check_backtrack_stop!(self); self.target_vars .borrow_mut() - .push(aug_assign_stmt.target.node.names[0].clone()); + .push(aug_assign_stmt.target.node.names[0].node.clone()); // Load the right value let right_value = self .walk_expr(&aug_assign_stmt.value) @@ -1281,7 +1281,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { { let mut local_vars = self.local_vars.borrow_mut(); for v in variables { - let name = &v.node.names[0]; + let name = &v.node.names[0].node; local_vars.insert(name.clone()); } } @@ -1539,7 +1539,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { let right_value = if is_membership_as_op { match &binary_expr.right.node { ast::Expr::Identifier(id) => { - let name = id.names.join("."); + let name = id.get_names().join("."); self.string_value(&name) } _ => self.none_value(), @@ -1634,7 +1634,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { .walk_expr(&selector_expr.value) .expect(kcl_error::COMPILE_ERROR_MSG); let string_ptr_value = self - .native_global_string(selector_expr.attr.node.names[0].as_str(), "") + .native_global_string(selector_expr.attr.node.names[0].node.as_str(), "") .into(); let fn_name = if selector_expr.has_question { &ApiFunc::kclvm_value_load_attr_option @@ -1643,7 +1643,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { }; value = self.build_call(&fn_name.name(), &[value, string_ptr_value]); for name in &selector_expr.attr.node.names[1..] { - let string_ptr_value = self.native_global_string(name, "").into(); + let string_ptr_value = self.native_global_string(&name.node, "").into(); value = self.build_call( &ApiFunc::kclvm_value_load_attr.name(), &[value, string_ptr_value], @@ -1672,7 +1672,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { } else { self.none_value() }; - self.dict_insert(dict_value, name.as_str(), value, 0, -1); + self.dict_insert(dict_value, name.node.as_str(), value, 0, -1); } let pkgpath = self.native_global_string_value(&self.current_pkgpath()); let is_in_schema = @@ -1933,7 +1933,7 @@ impl<'ctx> TypedResultWalker<'ctx> for LLVMCodeGenContext<'ctx> { } else { self.none_value() }; - self.dict_insert(dict_value, name.as_str(), value, 0, -1); + self.dict_insert(dict_value, name.node.as_str(), value, 0, -1); } let pkgpath = self.native_global_string_value(&self.current_pkgpath()); let schema = self.build_call( @@ -2285,7 +2285,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { match identifier_ctx { ast::ExprContext::Store => { if identifier.names.len() == 1 { - let name = identifier.names[0].as_str(); + let name = identifier.names[0].node.as_str(); let tpe = self.value_ptr_type(); // Global variables if self.scope_level() == GLOBAL_LEVEL { @@ -2416,7 +2416,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { } } else { let names = &identifier.names; - let name = names[0].as_str(); + let name = names[0].node.as_str(); let mut value = if is_in_schema { self.get_variable_in_schema(name) .expect(kcl_error::INTERNAL_ERROR_MSG) @@ -2425,7 +2425,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { .expect(kcl_error::INTERNAL_ERROR_MSG) }; for i in 0..names.len() - 1 { - let attr = names[i + 1].as_str(); + let attr = names[i + 1].node.as_str(); let ctx = if matches!(identifier_ctx, ast::ExprContext::Store) && i != names.len() - 2 && names.len() > 2 @@ -2459,7 +2459,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { Ok(right_value.expect(kcl_error::INTERNAL_ERROR_MSG)) } ast::ExprContext::Load => { - let name = identifier.names[0].as_str(); + let name = identifier.names[0].node.as_str(); let is_local_var = { let local_vars = self.local_vars.borrow_mut(); local_vars.contains(name) @@ -2472,7 +2472,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { } } else { let names = &identifier.names; - let name = names[0].as_str(); + let name = names[0].node.as_str(); let mut value = if identifier.pkgpath.is_empty() { if is_in_schema && !is_local_var { self.get_variable_in_schema(name) @@ -2485,7 +2485,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { self.ok_result().expect(kcl_error::INTERNAL_ERROR_MSG) }; for i in 0..names.len() - 1 { - let attr = names[i + 1].as_str(); + let attr = names[i + 1].node.as_str(); let ctx = if matches!(identifier_ctx, ast::ExprContext::Store) && i != names.len() - 2 && names.len() > 2 @@ -2560,7 +2560,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { } else { self.none_value() }; - self.dict_insert(dict_value, name.as_str(), value, 0, -1); + self.dict_insert(dict_value, name.node.as_str(), value, 0, -1); } let name = match &decorator.func.node { ast::Expr::Identifier(ident) if ident.names.len() == 1 => ident.names[0].clone(), @@ -2571,7 +2571,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { Ok(self.build_call( &ApiFunc::kclvm_value_Decorator.name(), &[ - self.native_global_string_value(name.as_str()), + self.native_global_string_value(name.node.as_str()), list_value, dict_value, schema_config_meta, @@ -2629,14 +2629,14 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { &ApiFunc::kclvm_list_get_option.name(), &[args, self.native_int_value(i as i32)], ); - self.store_variable(&arg_name.names[0], arg_value); + self.store_variable(&arg_name.names[0].node, arg_value); } // for loop in 0..argument_len in LLVM end self.br(end_block); self.builder.position_at_end(end_block); // Keyword arguments for arg_name in arg_names.iter() { - let name = &arg_name.names[0]; + let name = &arg_name.names[0].node; let string_ptr_value = self.native_global_string(name.as_str(), "").into(); let has_key = self .build_call( @@ -2660,7 +2660,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { &[kwargs, string_ptr_value], ); // Find argument name in the scope - self.store_variable(&arg_name.names[0], arg); + self.store_variable(&arg_name.names[0].node, arg); self.br(else_block); self.builder.position_at_end(else_block); } @@ -2704,7 +2704,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { { let mut local_vars = self.local_vars.borrow_mut(); for v in targets { - let name = &v.node.names[0]; + let name = &v.node.names[0].node; local_vars.insert(name.clone()); } } @@ -2780,7 +2780,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { { let mut local_vars = self.local_vars.borrow_mut(); for v in targets { - let name = &v.node.names[0]; + let name = &v.node.names[0].node; local_vars.remove(name); } } @@ -2797,7 +2797,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { if let Some(key) = &item.node.key { let mut insert_index = -1; let optional_name = match &key.node { - ast::Expr::Identifier(identifier) => Some(identifier.names[0].clone()), + ast::Expr::Identifier(identifier) => Some(identifier.names[0].node.clone()), ast::Expr::StringLit(string_lit) => Some(string_lit.value.clone()), ast::Expr::Subscript(subscript) => { let mut name = None; @@ -2806,7 +2806,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { if let ast::Expr::NumberLit(number) = &index_node.node { if let ast::NumberLitValue::Int(v) = number.value { insert_index = v; - name = Some(identifier.names[0].clone()) + name = Some(identifier.names[0].node.clone()) } } } diff --git a/kclvm/compiler/src/codegen/llvm/schema.rs b/kclvm/compiler/src/codegen/llvm/schema.rs index ad0510e0d..63db8e331 100644 --- a/kclvm/compiler/src/codegen/llvm/schema.rs +++ b/kclvm/compiler/src/codegen/llvm/schema.rs @@ -72,7 +72,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { for stmt in body { match &stmt.node { ast::Stmt::Unification(unification_stmt) => { - let name = &unification_stmt.target.node.names[0]; + let name = &unification_stmt.target.node.names[0].node; self.dict_merge(schema_value, name, value, 0, -1); if is_in_if { in_if_names.push(name.to_string()); @@ -82,7 +82,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { } ast::Stmt::Assign(assign_stmt) => { for target in &assign_stmt.targets { - let name = &target.node.names[0]; + let name = &target.node.names[0].node; self.dict_merge(schema_value, name, value, 0, -1); if is_in_if { in_if_names.push(name.to_string()); @@ -93,7 +93,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { } ast::Stmt::AugAssign(aug_assign_stmt) => { let target = &aug_assign_stmt.target; - let name = &target.node.names[0]; + let name = &target.node.names[0].node; self.dict_merge(schema_value, name, value, 0, -1); if is_in_if { in_if_names.push(name.to_string()); @@ -173,7 +173,7 @@ impl<'ctx> LLVMCodeGenContext<'ctx> { for item in &t.items { if let Some(key) = &item.node.key { let name = match &key.node { - ast::Expr::Identifier(t) => t.names[0].clone(), + ast::Expr::Identifier(t) => t.names[0].node.clone(), ast::Expr::NumberLit(t) => match t.value { ast::NumberLitValue::Int(i) => i.to_string(), ast::NumberLitValue::Float(f) => f.to_string(), diff --git a/kclvm/parser/src/parser/expr.rs b/kclvm/parser/src/parser/expr.rs index 73404da76..c94a920c2 100644 --- a/kclvm/parser/src/parser/expr.rs +++ b/kclvm/parser/src/parser/expr.rs @@ -328,7 +328,13 @@ impl<'a> Parser<'a> { _ => { let attr = Box::new(Node::node( Identifier { - names: vec!["".to_string()], + names: vec![Node::node( + "".to_string(), + ( + self.sess.lookup_char_pos(self.token.span.lo()), + self.sess.lookup_char_pos(self.token.span.lo()), + ), + )], pkgpath: "".to_string(), ctx: ExprContext::Load, }, @@ -2117,18 +2123,27 @@ impl<'a> Parser<'a> { pub(crate) fn parse_identifier(&mut self) -> NodeRef { let token = self.token; - let mut names = Vec::new(); + let mut names: Vec> = Vec::new(); let ident = self.token.ident(); match ident { Some(id) => { - names.push(id.as_str()); + names.push(Node::node( + id.as_str(), + self.sess.struct_token_loc(self.token, self.token), + )); self.bump(); } None => { { self.sess .struct_token_error(&[TokenKind::ident_value()], self.token); - names.push("".to_string()); + names.push(Node::node( + "".to_string(), + ( + self.sess.lookup_char_pos(self.token.span.lo()), + self.sess.lookup_char_pos(self.token.span.lo()), + ), + )); return Box::new(Node::node( Identifier { names, @@ -2152,13 +2167,22 @@ impl<'a> Parser<'a> { let ident = self.token.ident(); match ident { Some(id) => { - names.push(id.as_str().to_string()); + names.push(Node::node( + id.as_str(), + self.sess.struct_token_loc(self.token, self.token), + )); self.bump(); } None => { self.sess .struct_token_error(&[TokenKind::ident_value()], self.token); - names.push("".to_string()) + names.push(Node::node( + "".to_string(), + ( + self.sess.lookup_char_pos(self.token.span.lo()), + self.sess.lookup_char_pos(self.token.span.lo()), + ), + )) } } } diff --git a/kclvm/parser/src/parser/stmt.rs b/kclvm/parser/src/parser/stmt.rs index 2c2b56fd3..ede7ead9a 100644 --- a/kclvm/parser/src/parser/stmt.rs +++ b/kclvm/parser/src/parser/stmt.rs @@ -257,7 +257,7 @@ impl<'a> Parser<'a> { return Some(node_ref!( Stmt::SchemaAttr(SchemaAttr { doc: "".to_string(), - name: node_ref!(target.names.join("."), targets[0].pos()), + name: node_ref!(target.get_name(), targets[0].pos()), type_str: type_annotation.unwrap(), ty: ty.unwrap(), op: Some(BinOrAugOp::Aug(aug_op)), @@ -312,7 +312,7 @@ impl<'a> Parser<'a> { return Some(node_ref!( Stmt::SchemaAttr(SchemaAttr { doc: "".to_string(), - name: node_ref!(target.names.join("."), targets[0].pos()), + name: node_ref!(target.get_names().join("."), targets[0].pos()), type_str: type_annotation.unwrap(), ty: ty.unwrap(), op: None, @@ -401,20 +401,20 @@ impl<'a> Parser<'a> { let asname = if self.token.is_keyword(kw::As) { self.bump_keyword(kw::As); let ident = self.parse_identifier().node; - Some(ident.names.join(".")) + Some(ident.get_names().join(".")) } else { None }; let mut path = leading_dot.join(""); - path.push_str(dot_name.names.join(".").as_str()); + path.push_str(dot_name.get_names().join(".").as_str()); let rawpath = path.clone(); let name = if let Some(as_name_value) = asname.clone() { as_name_value } else { - dot_name.names.last().unwrap().clone() + dot_name.get_names().last().unwrap().clone() }; let t = node_ref!( @@ -612,7 +612,7 @@ impl<'a> Parser<'a> { let name_expr = self.parse_identifier(); let name_pos = name_expr.pos(); let name = name_expr.node; - let name = node_ref!(name.names.join("."), name_pos); + let name = node_ref!(name.get_names().join("."), name_pos); if name .node @@ -960,7 +960,7 @@ impl<'a> Parser<'a> { Stmt::SchemaAttr(SchemaAttr { doc: "".to_string(), name: node_ref!( - ident.names.join("."), + ident.get_names().join("."), assign.targets[0].pos() ), type_str, @@ -1095,7 +1095,7 @@ impl<'a> Parser<'a> { let name_pos = name_expr.pos(); let name = name_expr.node; - let name = node_ref!(name.names.join("."), name_pos); + let name = node_ref!(name.get_names().join("."), name_pos); let is_optional = if let TokenKind::Question = self.token.kind { self.bump_token(TokenKind::Question); @@ -1191,7 +1191,7 @@ impl<'a> Parser<'a> { let expr = self.parse_identifier_expr(); let ident = self.expr_as_identifier(expr.clone(), token); let pos = expr.pos(); - let key_name = ident.names.join("."); + let key_name = ident.get_names().join("."); if let TokenKind::CloseDelim(DelimToken::Bracket) = self.token.kind { let key_type = { @@ -1290,7 +1290,7 @@ impl<'a> Parser<'a> { let name_expr = self.parse_identifier_expr(); let name_pos = name_expr.pos(); let name = expr_as!(name_expr, Expr::Identifier).unwrap(); - let name = node_ref!(name.names.join("."), name_pos); + let name = node_ref!(name.get_names().join("."), name_pos); let args = if let TokenKind::OpenDelim(DelimToken::Bracket) = self.token.kind { self.parse_parameters( diff --git a/kclvm/parser/src/parser/tests.rs b/kclvm/parser/src/parser/tests.rs index 23d71d9aa..ed770b04f 100644 --- a/kclvm/parser/src/parser/tests.rs +++ b/kclvm/parser/src/parser/tests.rs @@ -214,7 +214,7 @@ fn binary_expr_3() { check_parsing_expr( r####"a or b"####, expect![[r#" - Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, op: Bin(Or), right: Node { node: Identifier(Identifier { names: ["b"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, op: Bin(Or), right: Node { node: Identifier(Identifier { names: [Node { node: "b", filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); } @@ -224,7 +224,7 @@ fn binary_expr_4() { check_parsing_expr( r####"x == a or b"####, expect![[r#" - Node { node: Binary(BinaryExpr { left: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["x"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [Eq], comparators: [Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 }, op: Bin(Or), right: Node { node: Identifier(Identifier { names: ["b"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } + Node { node: Binary(BinaryExpr { left: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "x", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [Eq], comparators: [Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 }, op: Bin(Or), right: Node { node: Identifier(Identifier { names: [Node { node: "b", filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } "#]], ); check_parsing_expr( @@ -236,19 +236,19 @@ fn binary_expr_4() { check_parsing_expr( r####"int(e.value) > 1 and i == 0"####, expect![[r#" - Node { node: Binary(BinaryExpr { left: Node { node: Compare(Compare { left: Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: ["int"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, args: [Node { node: Identifier(Identifier { names: ["e", "value"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 11 }], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 12 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 15, end_line: 1, end_column: 16 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 }, op: Bin(And), right: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["i"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, ops: [Eq], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 26, end_line: 1, end_column: 27 }] }), filename: "", line: 1, column: 21, end_line: 1, end_column: 27 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } + Node { node: Binary(BinaryExpr { left: Node { node: Compare(Compare { left: Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: [Node { node: "int", filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, args: [Node { node: Identifier(Identifier { names: [Node { node: "e", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: "value", filename: "", line: 1, column: 6, end_line: 1, end_column: 11 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 11 }], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 12 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 15, end_line: 1, end_column: 16 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 }, op: Bin(And), right: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "i", filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, ops: [Eq], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 26, end_line: 1, end_column: 27 }] }), filename: "", line: 1, column: 21, end_line: 1, end_column: 27 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } "#]], ); check_parsing_expr( r####"key in ['key']"####, expect![[r#" - Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["key"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, ops: [In], comparators: [Node { node: List(ListExpr { elts: [Node { node: StringLit(StringLit { is_long_string: false, raw_value: "'key'", value: "key" }), filename: "", line: 1, column: 8, end_line: 1, end_column: 13 }], ctx: Load }), filename: "", line: 1, column: 7, end_line: 1, end_column: 14 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 } + Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "key", filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, ops: [In], comparators: [Node { node: List(ListExpr { elts: [Node { node: StringLit(StringLit { is_long_string: false, raw_value: "'key'", value: "key" }), filename: "", line: 1, column: 8, end_line: 1, end_column: 13 }], ctx: Load }), filename: "", line: 1, column: 7, end_line: 1, end_column: 14 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 } "#]], ); check_parsing_expr( r####"key not in ['key']"####, expect![[r#" - Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["key"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, ops: [NotIn], comparators: [Node { node: List(ListExpr { elts: [Node { node: StringLit(StringLit { is_long_string: false, raw_value: "'key'", value: "key" }), filename: "", line: 1, column: 12, end_line: 1, end_column: 17 }], ctx: Load }), filename: "", line: 1, column: 11, end_line: 1, end_column: 18 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 18 } + Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "key", filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, ops: [NotIn], comparators: [Node { node: List(ListExpr { elts: [Node { node: StringLit(StringLit { is_long_string: false, raw_value: "'key'", value: "key" }), filename: "", line: 1, column: 12, end_line: 1, end_column: 17 }], ctx: Load }), filename: "", line: 1, column: 11, end_line: 1, end_column: 18 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 18 } "#]], ); @@ -265,8 +265,8 @@ fn binary_expr_5() { check_parsing_expr( r####"1 + a and b"####, expect![[r#" - Node { node: Binary(BinaryExpr { left: Node { node: Binary(BinaryExpr { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, op: Bin(Add), right: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, op: Bin(And), right: Node { node: Identifier(Identifier { names: ["b"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } - "#]], + Node { node: Binary(BinaryExpr { left: Node { node: Binary(BinaryExpr { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, op: Bin(Add), right: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, op: Bin(And), right: Node { node: Identifier(Identifier { names: [Node { node: "b", filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } + "#]], ); } @@ -285,25 +285,25 @@ fn logic_expr_0() { check_parsing_expr( r####"0 < a < 100"####, expect![[r#" - Node { node: Compare(Compare { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [Lt, Lt], comparators: [Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(100) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 11 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } + Node { node: Compare(Compare { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [Lt, Lt], comparators: [Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(100) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 11 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } "#]], ); check_parsing_expr( r####"0 < a < 100 + a"####, expect![[r#" - Node { node: Compare(Compare { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [Lt, Lt], comparators: [Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: Binary(BinaryExpr { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(100) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 11 }, op: Bin(Add), right: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 14, end_line: 1, end_column: 15 } }), filename: "", line: 1, column: 8, end_line: 1, end_column: 15 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 15 } + Node { node: Compare(Compare { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [Lt, Lt], comparators: [Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: Binary(BinaryExpr { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(100) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 11 }, op: Bin(Add), right: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 14, end_line: 1, end_column: 15 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 14, end_line: 1, end_column: 15 } }), filename: "", line: 1, column: 8, end_line: 1, end_column: 15 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 15 } "#]], ); check_parsing_expr( r####"100 > a > 0"####, expect![[r#" - Node { node: Compare(Compare { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(100) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, ops: [Gt, Gt], comparators: [Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } + Node { node: Compare(Compare { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(100) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, ops: [Gt, Gt], comparators: [Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } "#]], ); check_parsing_expr( r####"100 + a > a > 0"####, expect![[r#" - Node { node: Compare(Compare { left: Node { node: Binary(BinaryExpr { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(100) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, op: Bin(Add), right: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 }, ops: [Gt, Gt], comparators: [Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 14, end_line: 1, end_column: 15 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 15 } + Node { node: Compare(Compare { left: Node { node: Binary(BinaryExpr { left: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(100) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, op: Bin(Add), right: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 }, ops: [Gt, Gt], comparators: [Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 14, end_line: 1, end_column: 15 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 15 } "#]], ); } @@ -313,19 +313,19 @@ fn logic_expr_1() { check_parsing_expr( r####"a is b"####, expect![[r#" - Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [Is], comparators: [Node { node: Identifier(Identifier { names: ["b"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [Is], comparators: [Node { node: Identifier(Identifier { names: [Node { node: "b", filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); check_parsing_expr( r####"a is not True"####, expect![[r#" - Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [IsNot], comparators: [Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 1, column: 9, end_line: 1, end_column: 13 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 13 } + Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, ops: [IsNot], comparators: [Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 1, column: 9, end_line: 1, end_column: 13 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 13 } "#]], ); check_parsing_expr( r####"not False or a > 0 and b is True"####, expect![[r#" - Node { node: Binary(BinaryExpr { left: Node { node: Unary(UnaryExpr { op: Not, operand: Node { node: NameConstantLit(NameConstantLit { value: False }), filename: "", line: 1, column: 4, end_line: 1, end_column: 9 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 9 }, op: Bin(Or), right: Node { node: Binary(BinaryExpr { left: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 13, end_line: 1, end_column: 14 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 17, end_line: 1, end_column: 18 }] }), filename: "", line: 1, column: 13, end_line: 1, end_column: 32 }, op: Bin(And), right: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["b"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 23, end_line: 1, end_column: 24 }, ops: [Is], comparators: [Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 1, column: 28, end_line: 1, end_column: 32 }] }), filename: "", line: 1, column: 23, end_line: 1, end_column: 32 } }), filename: "", line: 1, column: 13, end_line: 1, end_column: 32 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 32 } + Node { node: Binary(BinaryExpr { left: Node { node: Unary(UnaryExpr { op: Not, operand: Node { node: NameConstantLit(NameConstantLit { value: False }), filename: "", line: 1, column: 4, end_line: 1, end_column: 9 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 9 }, op: Bin(Or), right: Node { node: Binary(BinaryExpr { left: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 13, end_line: 1, end_column: 14 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 13, end_line: 1, end_column: 14 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 17, end_line: 1, end_column: 18 }] }), filename: "", line: 1, column: 13, end_line: 1, end_column: 32 }, op: Bin(And), right: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "b", filename: "", line: 1, column: 23, end_line: 1, end_column: 24 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 23, end_line: 1, end_column: 24 }, ops: [Is], comparators: [Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 1, column: 28, end_line: 1, end_column: 32 }] }), filename: "", line: 1, column: 23, end_line: 1, end_column: 32 } }), filename: "", line: 1, column: 13, end_line: 1, end_column: 32 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 32 } "#]], ); } @@ -335,7 +335,7 @@ fn if_expr() { check_parsing_expr( r####"1 if true else 2"####, expect![[r#" - Node { node: If(IfExpr { body: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, cond: Node { node: Identifier(Identifier { names: ["true"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 5, end_line: 1, end_column: 9 }, orelse: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 15, end_line: 1, end_column: 16 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 16 } + Node { node: If(IfExpr { body: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, cond: Node { node: Identifier(Identifier { names: [Node { node: "true", filename: "", line: 1, column: 5, end_line: 1, end_column: 9 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 5, end_line: 1, end_column: 9 }, orelse: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 15, end_line: 1, end_column: 16 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 16 } "#]], ); } @@ -345,7 +345,7 @@ fn primary_expr_0() { check_parsing_expr( r####"a.b.c"####, expect![[r#" - Node { node: Identifier(Identifier { names: ["a", "b", "c"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } + Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, Node { node: "b", filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }, Node { node: "c", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } "#]], ); } @@ -355,7 +355,7 @@ fn primary_expr_1() { check_parsing_expr( r####"'{}'.format(1)"####, expect![[r#" - Node { node: Call(CallExpr { func: Node { node: Selector(SelectorExpr { value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "'{}'", value: "{}" }), filename: "", line: 1, column: 0, end_line: 1, end_column: 4 }, attr: Node { node: Identifier { names: ["format"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 5, end_line: 1, end_column: 11 }, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 12, end_line: 1, end_column: 13 }], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 } + Node { node: Call(CallExpr { func: Node { node: Selector(SelectorExpr { value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "'{}'", value: "{}" }), filename: "", line: 1, column: 0, end_line: 1, end_column: 4 }, attr: Node { node: Identifier { names: [Node { node: "format", filename: "", line: 1, column: 5, end_line: 1, end_column: 11 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 5, end_line: 1, end_column: 11 }, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 12, end_line: 1, end_column: 13 }], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 } "#]], ); } @@ -365,7 +365,7 @@ fn primary_expr_2() { check_parsing_expr( r####"str(1).isdigit()"####, expect![[r#" - Node { node: Call(CallExpr { func: Node { node: Selector(SelectorExpr { value: Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: ["str"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, attr: Node { node: Identifier { names: ["isdigit"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 14 }, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 }, args: [], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 16 } + Node { node: Call(CallExpr { func: Node { node: Selector(SelectorExpr { value: Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: [Node { node: "str", filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 3 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, attr: Node { node: Identifier { names: [Node { node: "isdigit", filename: "", line: 1, column: 7, end_line: 1, end_column: 14 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 14 }, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 }, args: [], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 16 } "#]], ); } @@ -392,7 +392,7 @@ fn list_comp_expr_0() { check_parsing_expr( r####"[x ** 2 for x in [1, 2, 3]]"####, expect![[r#" - Node { node: ListComp(ListComp { elt: Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: ["x"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }, op: Bin(Pow), right: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 } }), filename: "", line: 1, column: 1, end_line: 1, end_column: 7 }, generators: [Node { node: CompClause { targets: [Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 12, end_line: 1, end_column: 13 }], iter: Node { node: List(ListExpr { elts: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 18, end_line: 1, end_column: 19 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(3) }), filename: "", line: 1, column: 24, end_line: 1, end_column: 25 }], ctx: Load }), filename: "", line: 1, column: 17, end_line: 1, end_column: 26 }, ifs: [] }, filename: "", line: 1, column: 8, end_line: 1, end_column: 26 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } + Node { node: ListComp(ListComp { elt: Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: [Node { node: "x", filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }, op: Bin(Pow), right: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 } }), filename: "", line: 1, column: 1, end_line: 1, end_column: 7 }, generators: [Node { node: CompClause { targets: [Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 12, end_line: 1, end_column: 13 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 12, end_line: 1, end_column: 13 }], iter: Node { node: List(ListExpr { elts: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 18, end_line: 1, end_column: 19 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(3) }), filename: "", line: 1, column: 24, end_line: 1, end_column: 25 }], ctx: Load }), filename: "", line: 1, column: 17, end_line: 1, end_column: 26 }, ifs: [] }, filename: "", line: 1, column: 8, end_line: 1, end_column: 26 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } "#]], ); } @@ -402,7 +402,7 @@ fn list_comp_expr_1() { check_parsing_expr( r####"[i for i in [1, 2, 3] if i > 2]"####, expect![[r#" - Node { node: ListComp(ListComp { elt: Node { node: Identifier(Identifier { names: ["i"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }, generators: [Node { node: CompClause { targets: [Node { node: Identifier { names: ["i"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], iter: Node { node: List(ListExpr { elts: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 13, end_line: 1, end_column: 14 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 16, end_line: 1, end_column: 17 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(3) }), filename: "", line: 1, column: 19, end_line: 1, end_column: 20 }], ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 21 }, ifs: [Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["i"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 25, end_line: 1, end_column: 26 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 29, end_line: 1, end_column: 30 }] }), filename: "", line: 1, column: 25, end_line: 1, end_column: 30 }] }, filename: "", line: 1, column: 3, end_line: 1, end_column: 30 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 31 } + Node { node: ListComp(ListComp { elt: Node { node: Identifier(Identifier { names: [Node { node: "i", filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }, generators: [Node { node: CompClause { targets: [Node { node: Identifier { names: [Node { node: "i", filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], iter: Node { node: List(ListExpr { elts: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 13, end_line: 1, end_column: 14 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 16, end_line: 1, end_column: 17 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(3) }), filename: "", line: 1, column: 19, end_line: 1, end_column: 20 }], ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 21 }, ifs: [Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "i", filename: "", line: 1, column: 25, end_line: 1, end_column: 26 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 25, end_line: 1, end_column: 26 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 29, end_line: 1, end_column: 30 }] }), filename: "", line: 1, column: 25, end_line: 1, end_column: 30 }] }, filename: "", line: 1, column: 3, end_line: 1, end_column: 30 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 31 } "#]], ); } @@ -412,7 +412,7 @@ fn dict_expr() { check_parsing_expr( r####"{k0=v0, k1=v1}"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k0"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 3 }), value: Node { node: Identifier(Identifier { names: ["v0"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 6 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 1, end_line: 1, end_column: 6 }, Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k1"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 8, end_line: 1, end_column: 10 }), value: Node { node: Identifier(Identifier { names: ["v1"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 11, end_line: 1, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 8, end_line: 1, end_column: 13 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k0", filename: "", line: 1, column: 1, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 3 }), value: Node { node: Identifier(Identifier { names: [Node { node: "v0", filename: "", line: 1, column: 4, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 6 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 1, end_line: 1, end_column: 6 }, Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k1", filename: "", line: 1, column: 8, end_line: 1, end_column: 10 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 8, end_line: 1, end_column: 10 }), value: Node { node: Identifier(Identifier { names: [Node { node: "v1", filename: "", line: 1, column: 11, end_line: 1, end_column: 13 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 11, end_line: 1, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 8, end_line: 1, end_column: 13 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 } "#]], ); } @@ -422,7 +422,7 @@ fn dict_comp_expr() { check_parsing_expr( r####"{k: v + 1 for k, v in {k1 = 1, k2 = 2}}"####, expect![[r#" - Node { node: DictComp(DictComp { entry: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }), value: Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: ["v"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, op: Bin(Add), right: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 } }), filename: "", line: 1, column: 4, end_line: 1, end_column: 9 }, operation: Union, insert_index: -1 }, generators: [Node { node: CompClause { targets: [Node { node: Identifier { names: ["k"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 14, end_line: 1, end_column: 15 }, Node { node: Identifier { names: ["v"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 17, end_line: 1, end_column: 18 }], iter: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k1"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 23, end_line: 1, end_column: 25 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 28, end_line: 1, end_column: 29 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 23, end_line: 1, end_column: 29 }, Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k2"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 31, end_line: 1, end_column: 33 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 36, end_line: 1, end_column: 37 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 31, end_line: 1, end_column: 37 }] }), filename: "", line: 1, column: 22, end_line: 1, end_column: 38 }, ifs: [] }, filename: "", line: 1, column: 10, end_line: 1, end_column: 38 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 39 } + Node { node: DictComp(DictComp { entry: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k", filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }), value: Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: [Node { node: "v", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, op: Bin(Add), right: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 } }), filename: "", line: 1, column: 4, end_line: 1, end_column: 9 }, operation: Union, insert_index: -1 }, generators: [Node { node: CompClause { targets: [Node { node: Identifier { names: [Node { node: "k", filename: "", line: 1, column: 14, end_line: 1, end_column: 15 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 14, end_line: 1, end_column: 15 }, Node { node: Identifier { names: [Node { node: "v", filename: "", line: 1, column: 17, end_line: 1, end_column: 18 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 17, end_line: 1, end_column: 18 }], iter: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k1", filename: "", line: 1, column: 23, end_line: 1, end_column: 25 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 23, end_line: 1, end_column: 25 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 28, end_line: 1, end_column: 29 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 23, end_line: 1, end_column: 29 }, Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k2", filename: "", line: 1, column: 31, end_line: 1, end_column: 33 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 31, end_line: 1, end_column: 33 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 36, end_line: 1, end_column: 37 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 31, end_line: 1, end_column: 37 }] }), filename: "", line: 1, column: 22, end_line: 1, end_column: 38 }, ifs: [] }, filename: "", line: 1, column: 10, end_line: 1, end_column: 38 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 39 } "#]], ); } @@ -432,7 +432,7 @@ fn subscript_expr_0() { check_parsing_expr( r####"a[0]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), lower: None, upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 4 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), lower: None, upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 4 } "#]], ); } @@ -442,7 +442,7 @@ fn subscript_expr_1() { check_parsing_expr( r####"b["k"]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["b"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: Some(Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"k\"", value: "k" }), filename: "", line: 1, column: 2, end_line: 1, end_column: 5 }), lower: None, upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "b", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: Some(Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"k\"", value: "k" }), filename: "", line: 1, column: 2, end_line: 1, end_column: 5 }), lower: None, upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); } @@ -452,7 +452,7 @@ fn subscript_expr_2() { check_parsing_expr( r####"c?[1]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["c"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }), lower: None, upper: None, step: None, ctx: Load, has_question: true }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "c", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }), lower: None, upper: None, step: None, ctx: Load, has_question: true }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } "#]], ); } @@ -462,7 +462,7 @@ fn subscript_expr_3() { check_parsing_expr( r####"a[1:]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } "#]], ); } @@ -472,7 +472,7 @@ fn subscript_expr_4() { check_parsing_expr( r####"a[:-1]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: Some(Node { node: Unary(UnaryExpr { op: USub, operand: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 } }), filename: "", line: 1, column: 3, end_line: 1, end_column: 5 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: Some(Node { node: Unary(UnaryExpr { op: USub, operand: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 } }), filename: "", line: 1, column: 3, end_line: 1, end_column: 5 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); } @@ -482,7 +482,7 @@ fn subscript_expr_5() { check_parsing_expr( r####"a[1:len]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: Some(Node { node: Identifier(Identifier { names: ["len"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 7 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 8 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: Some(Node { node: Identifier(Identifier { names: [Node { node: "len", filename: "", line: 1, column: 4, end_line: 1, end_column: 7 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 7 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 8 } "#]], ); } @@ -492,7 +492,7 @@ fn subscript_expr_6() { check_parsing_expr( r####"a[0:-1]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: Some(Node { node: Unary(UnaryExpr { op: USub, operand: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 4, end_line: 1, end_column: 6 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: Some(Node { node: Unary(UnaryExpr { op: USub, operand: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 4, end_line: 1, end_column: 6 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } "#]], ); } @@ -502,7 +502,7 @@ fn subscript_expr_7() { check_parsing_expr( r####"a[::]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } "#]], ); } @@ -512,7 +512,7 @@ fn subscript_expr_8() { check_parsing_expr( r####"a[1::]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: None, step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); } @@ -522,7 +522,7 @@ fn subscript_expr_9() { check_parsing_expr( r####"a[:0:]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); } @@ -532,7 +532,7 @@ fn subscript_expr_10() { check_parsing_expr( r####"a[::-1]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: None, step: Some(Node { node: Unary(UnaryExpr { op: USub, operand: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 4, end_line: 1, end_column: 6 }), ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: None, step: Some(Node { node: Unary(UnaryExpr { op: USub, operand: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 4, end_line: 1, end_column: 6 }), ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } "#]], ); } @@ -542,7 +542,7 @@ fn subscript_expr_11() { check_parsing_expr( r####"a[1::2]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: None, step: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }), ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: None, step: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }), ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } "#]], ); } @@ -552,7 +552,7 @@ fn subscript_expr_12() { check_parsing_expr( r####"a[:2:1]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }), step: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }), ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: None, upper: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }), step: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }), ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } "#]], ); } @@ -562,7 +562,7 @@ fn subscript_expr_13() { check_parsing_expr( r####"a[1:2:]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }), step: None, ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } "#]], ); } @@ -572,7 +572,7 @@ fn subscript_expr_14() { check_parsing_expr( r####"a[1:3:1]"####, expect![[r#" - Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(3) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }), step: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }), ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 8 } + Node { node: Subscript(Subscript { value: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 1 }, index: None, lower: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), upper: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(3) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }), step: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }), ctx: Load, has_question: false }), filename: "", line: 1, column: 0, end_line: 1, end_column: 8 } "#]], ); } @@ -582,7 +582,7 @@ fn call_expr_0() { check_parsing_expr( r####"func0()"####, expect![[r#" - Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: ["func0"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, args: [], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } + Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: [Node { node: "func0", filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, args: [], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } "#]], ); } @@ -592,7 +592,7 @@ fn call_expr_1() { check_parsing_expr( r####"func1(1)"####, expect![[r#" - Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: ["func1"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 8 } + Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: [Node { node: "func1", filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }], keywords: [] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 8 } "#]], ); } @@ -602,7 +602,7 @@ fn call_expr_2() { check_parsing_expr( r####"func2(x=2)"####, expect![[r#" - Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: ["func2"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, args: [], keywords: [Node { node: Keyword { arg: Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }, value: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }) }, filename: "", line: 1, column: 6, end_line: 1, end_column: 9 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 10 } + Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: [Node { node: "func2", filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, args: [], keywords: [Node { node: Keyword { arg: Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }, value: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }) }, filename: "", line: 1, column: 6, end_line: 1, end_column: 9 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 10 } "#]], ); } @@ -612,7 +612,7 @@ fn call_expr_3() { check_parsing_expr( r####"func3(1,x=2)"####, expect![[r#" - Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: ["func3"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }], keywords: [Node { node: Keyword { arg: Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }, value: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }) }, filename: "", line: 1, column: 8, end_line: 1, end_column: 11 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 12 } + Node { node: Call(CallExpr { func: Node { node: Identifier(Identifier { names: [Node { node: "func3", filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }], keywords: [Node { node: Keyword { arg: Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }, value: Some(Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }) }, filename: "", line: 1, column: 8, end_line: 1, end_column: 11 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 12 } "#]], ); } @@ -622,7 +622,7 @@ fn quant_expr_0() { check_parsing_expr( r####"all x in collection {x > 0}"####, expect![[r#" - Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: ["collection"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }, variables: [Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], op: All, test: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["x"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 25, end_line: 1, end_column: 26 }] }), filename: "", line: 1, column: 21, end_line: 1, end_column: 26 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } + Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: [Node { node: "collection", filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }, variables: [Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], op: All, test: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "x", filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 25, end_line: 1, end_column: 26 }] }), filename: "", line: 1, column: 21, end_line: 1, end_column: 26 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } "#]], ); } @@ -632,7 +632,7 @@ fn quant_expr_1() { check_parsing_expr( r####"any y in collection {y < 0}"####, expect![[r#" - Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: ["collection"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }, variables: [Node { node: Identifier { names: ["y"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], op: Any, test: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["y"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, ops: [Lt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 25, end_line: 1, end_column: 26 }] }), filename: "", line: 1, column: 21, end_line: 1, end_column: 26 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } + Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: [Node { node: "collection", filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }, variables: [Node { node: Identifier { names: [Node { node: "y", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], op: Any, test: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "y", filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, ops: [Lt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 25, end_line: 1, end_column: 26 }] }), filename: "", line: 1, column: 21, end_line: 1, end_column: 26 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } "#]], ); } @@ -642,7 +642,7 @@ fn quant_expr_2() { check_parsing_expr( r####"map x in collection {x + 1}"####, expect![[r#" - Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: ["collection"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }, variables: [Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], op: Map, test: Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: ["x"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, op: Bin(Add), right: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 25, end_line: 1, end_column: 26 } }), filename: "", line: 1, column: 21, end_line: 1, end_column: 26 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } + Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: [Node { node: "collection", filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 9, end_line: 1, end_column: 19 }, variables: [Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], op: Map, test: Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: [Node { node: "x", filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 21, end_line: 1, end_column: 22 }, op: Bin(Add), right: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 25, end_line: 1, end_column: 26 } }), filename: "", line: 1, column: 21, end_line: 1, end_column: 26 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 27 } "#]], ); } @@ -652,7 +652,7 @@ fn quant_expr_3() { check_parsing_expr( r####"filter x in collection {x > 1}"####, expect![[r#" - Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: ["collection"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 22 }, variables: [Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], op: Filter, test: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["x"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 24, end_line: 1, end_column: 25 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 28, end_line: 1, end_column: 29 }] }), filename: "", line: 1, column: 24, end_line: 1, end_column: 29 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 30 } + Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: [Node { node: "collection", filename: "", line: 1, column: 12, end_line: 1, end_column: 22 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 22 }, variables: [Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], op: Filter, test: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "x", filename: "", line: 1, column: 24, end_line: 1, end_column: 25 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 24, end_line: 1, end_column: 25 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 28, end_line: 1, end_column: 29 }] }), filename: "", line: 1, column: 24, end_line: 1, end_column: 29 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 30 } "#]], ); } @@ -662,7 +662,7 @@ fn quant_expr_4() { check_parsing_expr( r####"filter x in collection {x > 1}"####, expect![[r#" - Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: ["collection"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 22 }, variables: [Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], op: Filter, test: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["x"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 24, end_line: 1, end_column: 25 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 28, end_line: 1, end_column: 29 }] }), filename: "", line: 1, column: 24, end_line: 1, end_column: 29 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 30 } + Node { node: Quant(QuantExpr { target: Node { node: Identifier(Identifier { names: [Node { node: "collection", filename: "", line: 1, column: 12, end_line: 1, end_column: 22 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 22 }, variables: [Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], op: Filter, test: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "x", filename: "", line: 1, column: 24, end_line: 1, end_column: 25 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 24, end_line: 1, end_column: 25 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 28, end_line: 1, end_column: 29 }] }), filename: "", line: 1, column: 24, end_line: 1, end_column: 29 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 30 } "#]], ); } @@ -672,7 +672,7 @@ fn quant_expr_5() { check_parsing_expr( r####"map i, e in [{k1 = "v1", k2 = "v2"}] { e }"####, expect![[r#" - Node { node: Quant(QuantExpr { target: Node { node: List(ListExpr { elts: [Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k1"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 14, end_line: 1, end_column: 16 }), value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"v1\"", value: "v1" }), filename: "", line: 1, column: 19, end_line: 1, end_column: 23 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 14, end_line: 1, end_column: 23 }, Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k2"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 25, end_line: 1, end_column: 27 }), value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"v2\"", value: "v2" }), filename: "", line: 1, column: 30, end_line: 1, end_column: 34 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 25, end_line: 1, end_column: 34 }] }), filename: "", line: 1, column: 13, end_line: 1, end_column: 35 }], ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 36 }, variables: [Node { node: Identifier { names: ["i"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: Identifier { names: ["e"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], op: Map, test: Node { node: Identifier(Identifier { names: ["e"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 39, end_line: 1, end_column: 40 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 42 } + Node { node: Quant(QuantExpr { target: Node { node: List(ListExpr { elts: [Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k1", filename: "", line: 1, column: 14, end_line: 1, end_column: 16 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 14, end_line: 1, end_column: 16 }), value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"v1\"", value: "v1" }), filename: "", line: 1, column: 19, end_line: 1, end_column: 23 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 14, end_line: 1, end_column: 23 }, Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k2", filename: "", line: 1, column: 25, end_line: 1, end_column: 27 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 25, end_line: 1, end_column: 27 }), value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"v2\"", value: "v2" }), filename: "", line: 1, column: 30, end_line: 1, end_column: 34 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 25, end_line: 1, end_column: 34 }] }), filename: "", line: 1, column: 13, end_line: 1, end_column: 35 }], ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 36 }, variables: [Node { node: Identifier { names: [Node { node: "i", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: Identifier { names: [Node { node: "e", filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], op: Map, test: Node { node: Identifier(Identifier { names: [Node { node: "e", filename: "", line: 1, column: 39, end_line: 1, end_column: 40 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 39, end_line: 1, end_column: 40 }, if_cond: None, ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 42 } "#]], ); } @@ -682,7 +682,7 @@ fn quant_expr_6() { check_parsing_expr( r####"map i, e in [{k1 = "v1", k2 = "v2"}] { e if i > 0 }"####, expect![[r#" - Node { node: Quant(QuantExpr { target: Node { node: List(ListExpr { elts: [Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k1"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 14, end_line: 1, end_column: 16 }), value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"v1\"", value: "v1" }), filename: "", line: 1, column: 19, end_line: 1, end_column: 23 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 14, end_line: 1, end_column: 23 }, Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k2"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 25, end_line: 1, end_column: 27 }), value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"v2\"", value: "v2" }), filename: "", line: 1, column: 30, end_line: 1, end_column: 34 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 25, end_line: 1, end_column: 34 }] }), filename: "", line: 1, column: 13, end_line: 1, end_column: 35 }], ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 36 }, variables: [Node { node: Identifier { names: ["i"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: Identifier { names: ["e"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], op: Map, test: Node { node: Identifier(Identifier { names: ["e"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 39, end_line: 1, end_column: 40 }, if_cond: Some(Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["i"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 44, end_line: 1, end_column: 45 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 48, end_line: 1, end_column: 49 }] }), filename: "", line: 1, column: 44, end_line: 1, end_column: 49 }), ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 51 } + Node { node: Quant(QuantExpr { target: Node { node: List(ListExpr { elts: [Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k1", filename: "", line: 1, column: 14, end_line: 1, end_column: 16 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 14, end_line: 1, end_column: 16 }), value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"v1\"", value: "v1" }), filename: "", line: 1, column: 19, end_line: 1, end_column: 23 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 14, end_line: 1, end_column: 23 }, Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k2", filename: "", line: 1, column: 25, end_line: 1, end_column: 27 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 25, end_line: 1, end_column: 27 }), value: Node { node: StringLit(StringLit { is_long_string: false, raw_value: "\"v2\"", value: "v2" }), filename: "", line: 1, column: 30, end_line: 1, end_column: 34 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 25, end_line: 1, end_column: 34 }] }), filename: "", line: 1, column: 13, end_line: 1, end_column: 35 }], ctx: Load }), filename: "", line: 1, column: 12, end_line: 1, end_column: 36 }, variables: [Node { node: Identifier { names: [Node { node: "i", filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, Node { node: Identifier { names: [Node { node: "e", filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], op: Map, test: Node { node: Identifier(Identifier { names: [Node { node: "e", filename: "", line: 1, column: 39, end_line: 1, end_column: 40 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 39, end_line: 1, end_column: 40 }, if_cond: Some(Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "i", filename: "", line: 1, column: 44, end_line: 1, end_column: 45 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 44, end_line: 1, end_column: 45 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(0) }), filename: "", line: 1, column: 48, end_line: 1, end_column: 49 }] }), filename: "", line: 1, column: 44, end_line: 1, end_column: 49 }), ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 51 } "#]], ); } @@ -702,7 +702,7 @@ fn lambda_expr_1() { check_parsing_expr( r####"lambda x {}"####, expect![[r#" - Node { node: Lambda(LambdaExpr { args: Some(Node { node: Arguments { args: [Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], defaults: [None], type_annotation_list: [None], ty_list: [None] }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }), return_type_str: None, body: [], return_ty: None }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } + Node { node: Lambda(LambdaExpr { args: Some(Node { node: Arguments { args: [Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], defaults: [None], type_annotation_list: [None], ty_list: [None] }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }), return_type_str: None, body: [], return_ty: None }), filename: "", line: 1, column: 0, end_line: 1, end_column: 11 } "#]], ); } @@ -712,7 +712,7 @@ fn lambda_expr_2() { check_parsing_expr( r####"lambda x: int -> int {x}"####, expect![[r#" - Node { node: Lambda(LambdaExpr { args: Some(Node { node: Arguments { args: [Node { node: Identifier { names: ["x"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], defaults: [None], type_annotation_list: [Some(Node { node: "int", filename: "", line: 1, column: 10, end_line: 1, end_column: 13 })], ty_list: [Some(Node { node: Basic(Int), filename: "", line: 1, column: 10, end_line: 1, end_column: 13 })] }, filename: "", line: 1, column: 7, end_line: 1, end_column: 13 }), return_type_str: Some("int"), body: [Node { node: Expr(ExprStmt { exprs: [Node { node: Identifier(Identifier { names: ["x"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 22, end_line: 1, end_column: 23 }] }), filename: "", line: 1, column: 22, end_line: 1, end_column: 23 }], return_ty: Some(Node { node: Basic(Int), filename: "", line: 1, column: 17, end_line: 1, end_column: 20 }) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 24 } + Node { node: Lambda(LambdaExpr { args: Some(Node { node: Arguments { args: [Node { node: Identifier { names: [Node { node: "x", filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 7, end_line: 1, end_column: 8 }], defaults: [None], type_annotation_list: [Some(Node { node: "int", filename: "", line: 1, column: 10, end_line: 1, end_column: 13 })], ty_list: [Some(Node { node: Basic(Int), filename: "", line: 1, column: 10, end_line: 1, end_column: 13 })] }, filename: "", line: 1, column: 7, end_line: 1, end_column: 13 }), return_type_str: Some("int"), body: [Node { node: Expr(ExprStmt { exprs: [Node { node: Identifier(Identifier { names: [Node { node: "x", filename: "", line: 1, column: 22, end_line: 1, end_column: 23 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 22, end_line: 1, end_column: 23 }] }), filename: "", line: 1, column: 22, end_line: 1, end_column: 23 }], return_ty: Some(Node { node: Basic(Int), filename: "", line: 1, column: 17, end_line: 1, end_column: 20 }) }), filename: "", line: 1, column: 0, end_line: 1, end_column: 24 } "#]], ); } @@ -728,7 +728,7 @@ fn lambda_expr_3() { _a }"####, expect![[r#" - Node { node: Lambda(LambdaExpr { args: None, return_type_str: None, body: [Node { node: If(IfStmt { body: [Node { node: Assign(AssignStmt { targets: [Node { node: Identifier { names: ["_a"], pkgpath: "", ctx: Store }, filename: "", line: 3, column: 8, end_line: 3, end_column: 10 }], value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 3, column: 13, end_line: 3, end_column: 14 }, type_annotation: None, ty: None }), filename: "", line: 3, column: 8, end_line: 3, end_column: 14 }], cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, orelse: [Node { node: Assign(AssignStmt { targets: [Node { node: Identifier { names: ["_a"], pkgpath: "", ctx: Store }, filename: "", line: 5, column: 8, end_line: 5, end_column: 10 }], value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 5, column: 13, end_line: 5, end_column: 14 }, type_annotation: None, ty: None }), filename: "", line: 5, column: 8, end_line: 5, end_column: 14 }] }), filename: "", line: 2, column: 4, end_line: 6, end_column: 4 }, Node { node: Expr(ExprStmt { exprs: [Node { node: Identifier(Identifier { names: ["_a"], pkgpath: "", ctx: Load }), filename: "", line: 6, column: 4, end_line: 6, end_column: 6 }] }), filename: "", line: 6, column: 4, end_line: 6, end_column: 6 }], return_ty: None }), filename: "", line: 1, column: 0, end_line: 7, end_column: 1 } + Node { node: Lambda(LambdaExpr { args: None, return_type_str: None, body: [Node { node: If(IfStmt { body: [Node { node: Assign(AssignStmt { targets: [Node { node: Identifier { names: [Node { node: "_a", filename: "", line: 3, column: 8, end_line: 3, end_column: 10 }], pkgpath: "", ctx: Store }, filename: "", line: 3, column: 8, end_line: 3, end_column: 10 }], value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 3, column: 13, end_line: 3, end_column: 14 }, type_annotation: None, ty: None }), filename: "", line: 3, column: 8, end_line: 3, end_column: 14 }], cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, orelse: [Node { node: Assign(AssignStmt { targets: [Node { node: Identifier { names: [Node { node: "_a", filename: "", line: 5, column: 8, end_line: 5, end_column: 10 }], pkgpath: "", ctx: Store }, filename: "", line: 5, column: 8, end_line: 5, end_column: 10 }], value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 5, column: 13, end_line: 5, end_column: 14 }, type_annotation: None, ty: None }), filename: "", line: 5, column: 8, end_line: 5, end_column: 14 }] }), filename: "", line: 2, column: 4, end_line: 6, end_column: 4 }, Node { node: Expr(ExprStmt { exprs: [Node { node: Identifier(Identifier { names: [Node { node: "_a", filename: "", line: 6, column: 4, end_line: 6, end_column: 6 }], pkgpath: "", ctx: Load }), filename: "", line: 6, column: 4, end_line: 6, end_column: 6 }] }), filename: "", line: 6, column: 4, end_line: 6, end_column: 6 }], return_ty: None }), filename: "", line: 1, column: 0, end_line: 7, end_column: 1 } "#]], ); } @@ -786,7 +786,7 @@ fn config_if_expr_0() { a = 1 }"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }], orelse: None }), filename: "", line: 3, column: 8, end_line: 4, end_column: 0 }, operation: Union, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 4, end_column: 0 }] }), filename: "", line: 1, column: 0, end_line: 4, end_column: 1 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }], pkgpath: "", ctx: Load }), filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }], orelse: None }), filename: "", line: 3, column: 8, end_line: 4, end_column: 0 }, operation: Union, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 4, end_column: 0 }] }), filename: "", line: 1, column: 0, end_line: 4, end_column: 1 } "#]], ); } @@ -801,7 +801,7 @@ fn config_if_expr_1() { a = 2 }"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }], orelse: Some(Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 5, column: 8, end_line: 5, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 5, column: 12, end_line: 5, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 5, column: 12, end_line: 5, end_column: 13 }] }), filename: "", line: 4, column: 4, end_line: 6, end_column: 0 }) }), filename: "", line: 3, column: 8, end_line: 4, end_column: 4 }, operation: Union, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 6, end_column: 0 }] }), filename: "", line: 1, column: 0, end_line: 6, end_column: 1 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }], pkgpath: "", ctx: Load }), filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }], orelse: Some(Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 5, column: 8, end_line: 5, end_column: 9 }], pkgpath: "", ctx: Load }), filename: "", line: 5, column: 8, end_line: 5, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 5, column: 12, end_line: 5, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 5, column: 12, end_line: 5, end_column: 13 }] }), filename: "", line: 4, column: 4, end_line: 6, end_column: 0 }) }), filename: "", line: 3, column: 8, end_line: 4, end_column: 4 }, operation: Union, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 6, end_column: 0 }] }), filename: "", line: 1, column: 0, end_line: 6, end_column: 1 } "#]], ); } @@ -818,7 +818,7 @@ fn config_if_expr_2() { a = 3 }"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }], orelse: Some(Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: ["x"], pkgpath: "", ctx: Load }), filename: "", line: 4, column: 9, end_line: 4, end_column: 10 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 4, column: 13, end_line: 4, end_column: 14 }] }), filename: "", line: 4, column: 9, end_line: 4, end_column: 14 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 5, column: 8, end_line: 5, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 5, column: 12, end_line: 5, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 5, column: 12, end_line: 5, end_column: 13 }], orelse: Some(Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 7, column: 8, end_line: 7, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(3) }), filename: "", line: 7, column: 12, end_line: 7, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 7, column: 12, end_line: 7, end_column: 13 }] }), filename: "", line: 6, column: 4, end_line: 8, end_column: 0 }) }), filename: "", line: 4, column: 4, end_line: 6, end_column: 4 }) }), filename: "", line: 3, column: 8, end_line: 4, end_column: 4 }, operation: Union, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 8, end_column: 0 }] }), filename: "", line: 1, column: 0, end_line: 8, end_column: 1 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }], pkgpath: "", ctx: Load }), filename: "", line: 3, column: 8, end_line: 3, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 3, column: 12, end_line: 3, end_column: 13 }], orelse: Some(Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: Compare(Compare { left: Node { node: Identifier(Identifier { names: [Node { node: "x", filename: "", line: 4, column: 9, end_line: 4, end_column: 10 }], pkgpath: "", ctx: Load }), filename: "", line: 4, column: 9, end_line: 4, end_column: 10 }, ops: [Gt], comparators: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 4, column: 13, end_line: 4, end_column: 14 }] }), filename: "", line: 4, column: 9, end_line: 4, end_column: 14 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 5, column: 8, end_line: 5, end_column: 9 }], pkgpath: "", ctx: Load }), filename: "", line: 5, column: 8, end_line: 5, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 5, column: 12, end_line: 5, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 5, column: 12, end_line: 5, end_column: 13 }], orelse: Some(Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 7, column: 8, end_line: 7, end_column: 9 }], pkgpath: "", ctx: Load }), filename: "", line: 7, column: 8, end_line: 7, end_column: 9 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(3) }), filename: "", line: 7, column: 12, end_line: 7, end_column: 13 }, operation: Override, insert_index: -1 }, filename: "", line: 7, column: 12, end_line: 7, end_column: 13 }] }), filename: "", line: 6, column: 4, end_line: 8, end_column: 0 }) }), filename: "", line: 4, column: 4, end_line: 6, end_column: 4 }) }), filename: "", line: 3, column: 8, end_line: 4, end_column: 4 }, operation: Union, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 8, end_column: 0 }] }), filename: "", line: 1, column: 0, end_line: 8, end_column: 1 } "#]], ); } @@ -832,7 +832,7 @@ fn config_if_expr_3() { a = 1 }"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: False }), filename: "", line: 3, column: 11, end_line: 3, end_column: 16 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 4, column: 12, end_line: 4, end_column: 13 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 4, column: 16, end_line: 4, end_column: 17 }, operation: Override, insert_index: -1 }, filename: "", line: 4, column: 16, end_line: 4, end_column: 17 }], orelse: None }), filename: "", line: 4, column: 12, end_line: 5, end_column: 0 }, operation: Override, insert_index: -1 }, filename: "", line: 4, column: 12, end_line: 5, end_column: 0 }], orelse: None }), filename: "", line: 3, column: 8, end_line: 5, end_column: 0 }, operation: Union, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 5, end_column: 0 }] }), filename: "", line: 1, column: 0, end_line: 5, end_column: 1 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: True }), filename: "", line: 2, column: 7, end_line: 2, end_column: 11 }, items: [Node { node: ConfigEntry { key: None, value: Node { node: ConfigIfEntry(ConfigIfEntryExpr { if_cond: Node { node: NameConstantLit(NameConstantLit { value: False }), filename: "", line: 3, column: 11, end_line: 3, end_column: 16 }, items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 4, column: 12, end_line: 4, end_column: 13 }], pkgpath: "", ctx: Load }), filename: "", line: 4, column: 12, end_line: 4, end_column: 13 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 4, column: 16, end_line: 4, end_column: 17 }, operation: Override, insert_index: -1 }, filename: "", line: 4, column: 16, end_line: 4, end_column: 17 }], orelse: None }), filename: "", line: 4, column: 12, end_line: 5, end_column: 0 }, operation: Override, insert_index: -1 }, filename: "", line: 4, column: 12, end_line: 5, end_column: 0 }], orelse: None }), filename: "", line: 3, column: 8, end_line: 5, end_column: 0 }, operation: Union, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 5, end_column: 0 }] }), filename: "", line: 1, column: 0, end_line: 5, end_column: 1 } "#]], ); } @@ -842,7 +842,7 @@ fn schema_expr_0() { check_parsing_expr( r####"Schema {}"####, expect![[r#" - Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: ["Schema"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [], kwargs: [], config: Node { node: Config(ConfigExpr { items: [] }), filename: "", line: 1, column: 7, end_line: 1, end_column: 9 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 9 } + Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: [Node { node: "Schema", filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [], kwargs: [], config: Node { node: Config(ConfigExpr { items: [] }), filename: "", line: 1, column: 7, end_line: 1, end_column: 9 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 9 } "#]], ); } @@ -852,7 +852,7 @@ fn schema_expr_1() { check_parsing_expr( r####"Schema {k=v}"####, expect![[r#" - Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: ["Schema"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [], kwargs: [], config: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }), value: Node { node: Identifier(Identifier { names: ["v"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 8, end_line: 1, end_column: 11 }] }), filename: "", line: 1, column: 7, end_line: 1, end_column: 12 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 12 } + Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: [Node { node: "Schema", filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [], kwargs: [], config: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k", filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }), value: Node { node: Identifier(Identifier { names: [Node { node: "v", filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 10, end_line: 1, end_column: 11 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 8, end_line: 1, end_column: 11 }] }), filename: "", line: 1, column: 7, end_line: 1, end_column: 12 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 12 } "#]], ); } @@ -862,7 +862,7 @@ fn schema_expr_2() { check_parsing_expr( r####"Schema () {k=v}"####, expect![[r#" - Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: ["Schema"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [], kwargs: [], config: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 11, end_line: 1, end_column: 12 }), value: Node { node: Identifier(Identifier { names: ["v"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 13, end_line: 1, end_column: 14 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 11, end_line: 1, end_column: 14 }] }), filename: "", line: 1, column: 10, end_line: 1, end_column: 15 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 15 } + Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: [Node { node: "Schema", filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [], kwargs: [], config: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k", filename: "", line: 1, column: 11, end_line: 1, end_column: 12 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 11, end_line: 1, end_column: 12 }), value: Node { node: Identifier(Identifier { names: [Node { node: "v", filename: "", line: 1, column: 13, end_line: 1, end_column: 14 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 13, end_line: 1, end_column: 14 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 11, end_line: 1, end_column: 14 }] }), filename: "", line: 1, column: 10, end_line: 1, end_column: 15 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 15 } "#]], ); } @@ -872,7 +872,7 @@ fn schema_expr_3() { check_parsing_expr( r####"Schema (1, 2) {k=v}"####, expect![[r#" - Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: ["Schema"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 11, end_line: 1, end_column: 12 }], kwargs: [], config: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 15, end_line: 1, end_column: 16 }), value: Node { node: Identifier(Identifier { names: ["v"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 17, end_line: 1, end_column: 18 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 15, end_line: 1, end_column: 18 }] }), filename: "", line: 1, column: 14, end_line: 1, end_column: 19 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 19 } + Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: [Node { node: "Schema", filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 11, end_line: 1, end_column: 12 }], kwargs: [], config: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k", filename: "", line: 1, column: 15, end_line: 1, end_column: 16 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 15, end_line: 1, end_column: 16 }), value: Node { node: Identifier(Identifier { names: [Node { node: "v", filename: "", line: 1, column: 17, end_line: 1, end_column: 18 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 17, end_line: 1, end_column: 18 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 15, end_line: 1, end_column: 18 }] }), filename: "", line: 1, column: 14, end_line: 1, end_column: 19 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 19 } "#]], ); } @@ -884,7 +884,7 @@ fn schema_expr_4() { k=v }"####, expect![[r#" - Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: ["Schema"], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 11, end_line: 1, end_column: 12 }], kwargs: [], config: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["k"], pkgpath: "", ctx: Load }), filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }), value: Node { node: Identifier(Identifier { names: ["v"], pkgpath: "", ctx: Load }), filename: "", line: 2, column: 6, end_line: 2, end_column: 7 }, operation: Override, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 2, end_column: 7 }] }), filename: "", line: 1, column: 14, end_line: 3, end_column: 1 } }), filename: "", line: 1, column: 0, end_line: 3, end_column: 1 } + Node { node: Schema(SchemaExpr { name: Node { node: Identifier { names: [Node { node: "Schema", filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }, filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }, args: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 }, Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 11, end_line: 1, end_column: 12 }], kwargs: [], config: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "k", filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }), value: Node { node: Identifier(Identifier { names: [Node { node: "v", filename: "", line: 2, column: 6, end_line: 2, end_column: 7 }], pkgpath: "", ctx: Load }), filename: "", line: 2, column: 6, end_line: 2, end_column: 7 }, operation: Override, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 2, end_column: 7 }] }), filename: "", line: 1, column: 14, end_line: 3, end_column: 1 } }), filename: "", line: 1, column: 0, end_line: 3, end_column: 1 } "#]], ); } @@ -1023,13 +1023,13 @@ fn test_named_type() { check_parsing_type( r####"Person"####, expect![[r#" - Node { node: Named(Identifier { names: ["Person"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Named(Identifier { names: [Node { node: "Person", filename: "", line: 1, column: 0, end_line: 1, end_column: 6 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); check_parsing_type( r####"some.pkg.Person"####, expect![[r#" - Node { node: Named(Identifier { names: ["some", "pkg", "Person"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 15 } + Node { node: Named(Identifier { names: [Node { node: "some", filename: "", line: 1, column: 0, end_line: 1, end_column: 4 }, Node { node: "pkg", filename: "", line: 1, column: 5, end_line: 1, end_column: 8 }, Node { node: "Person", filename: "", line: 1, column: 9, end_line: 1, end_column: 15 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 15 } "#]], ) } @@ -1126,7 +1126,7 @@ schema TestBool: name not None, "we fail here" "####, expect![[r#" - {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Schema":{"doc":"","name":{"node":"TestBool","filename":"hello.k","line":2,"column":7,"end_line":2,"end_column":15},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[],"ctx":"Load"}},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":6}]}},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":6},{"node":{"SchemaAttr":{"doc":"","name":{"node":"a","filename":"hello.k","line":8,"column":4,"end_line":8,"end_column":5},"type_str":{"node":"int","filename":"hello.k","line":8,"column":7,"end_line":8,"end_column":10},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Int"},"filename":"hello.k","line":8,"column":7,"end_line":8,"end_column":10}}},"filename":"hello.k","line":8,"column":4,"end_line":8,"end_column":10},{"node":{"SchemaAttr":{"doc":"","name":{"node":"b","filename":"hello.k","line":9,"column":4,"end_line":9,"end_column":5},"type_str":{"node":"str","filename":"hello.k","line":9,"column":8,"end_line":9,"end_column":11},"op":null,"value":null,"is_optional":true,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"hello.k","line":9,"column":8,"end_line":9,"end_column":11}}},"filename":"hello.k","line":9,"column":4,"end_line":10,"end_column":0},{"node":{"SchemaAttr":{"doc":"","name":{"node":"c","filename":"hello.k","line":10,"column":4,"end_line":10,"end_column":5},"type_str":{"node":"int","filename":"hello.k","line":10,"column":7,"end_line":10,"end_column":10},"op":{"Aug":"Assign"},"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":0}}},"filename":"hello.k","line":10,"column":13,"end_line":10,"end_column":14},"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Int"},"filename":"hello.k","line":10,"column":7,"end_line":10,"end_column":10}}},"filename":"hello.k","line":10,"column":4,"end_line":10,"end_column":14},{"node":{"SchemaAttr":{"doc":"","name":{"node":"d","filename":"hello.k","line":11,"column":4,"end_line":11,"end_column":5},"type_str":{"node":"str","filename":"hello.k","line":11,"column":8,"end_line":11,"end_column":11},"op":{"Aug":"Assign"},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"\"","value":""}},"filename":"hello.k","line":11,"column":14,"end_line":11,"end_column":16},"is_optional":true,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"hello.k","line":11,"column":8,"end_line":11,"end_column":11}}},"filename":"hello.k","line":11,"column":4,"end_line":13,"end_column":0},{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":13,"column":5,"end_line":13,"end_column":6}],"ctx":"Load"}},"filename":"hello.k","line":13,"column":4,"end_line":13,"end_column":7}]}},"filename":"hello.k","line":13,"column":4,"end_line":13,"end_column":7},{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":14,"column":5,"end_line":14,"end_column":6},{"node":{"Identifier":{"names":["b"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":14,"column":8,"end_line":14,"end_column":9},{"node":{"Identifier":{"names":["c"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":14,"column":11,"end_line":14,"end_column":12}],"ctx":"Load"}},"filename":"hello.k","line":14,"column":4,"end_line":14,"end_column":13}]}},"filename":"hello.k","line":14,"column":4,"end_line":14,"end_column":13},{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":16,"column":8,"end_line":16,"end_column":9}],"ctx":"Load"}},"filename":"hello.k","line":15,"column":4,"end_line":17,"end_column":5}]}},"filename":"hello.k","line":15,"column":4,"end_line":17,"end_column":5},{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":19,"column":8,"end_line":19,"end_column":9}],"ctx":"Load"}},"filename":"hello.k","line":18,"column":4,"end_line":20,"end_column":5}]}},"filename":"hello.k","line":18,"column":4,"end_line":20,"end_column":5},{"node":{"Expr":{"exprs":[{"node":{"ListComp":{"elt":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":21,"column":5,"end_line":21,"end_column":6},"generators":[{"node":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Load"},"filename":"hello.k","line":21,"column":11,"end_line":21,"end_column":12}],"iter":{"node":{"List":{"elts":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":21,"column":17,"end_line":21,"end_column":18},{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"hello.k","line":21,"column":20,"end_line":21,"end_column":21},{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"hello.k","line":21,"column":23,"end_line":21,"end_column":24}],"ctx":"Load"}},"filename":"hello.k","line":21,"column":16,"end_line":21,"end_column":25},"ifs":[]},"filename":"hello.k","line":21,"column":7,"end_line":21,"end_column":25}]}},"filename":"hello.k","line":21,"column":4,"end_line":21,"end_column":26}]}},"filename":"hello.k","line":21,"column":4,"end_line":21,"end_column":26},{"node":{"Expr":{"exprs":[{"node":{"ListComp":{"elt":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":23,"column":8,"end_line":23,"end_column":9},"generators":[{"node":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Load"},"filename":"hello.k","line":23,"column":14,"end_line":23,"end_column":15}],"iter":{"node":{"List":{"elts":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":23,"column":20,"end_line":23,"end_column":21},{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"hello.k","line":23,"column":23,"end_line":23,"end_column":24},{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"hello.k","line":23,"column":26,"end_line":23,"end_column":27}],"ctx":"Load"}},"filename":"hello.k","line":23,"column":19,"end_line":23,"end_column":28},"ifs":[]},"filename":"hello.k","line":23,"column":10,"end_line":24,"end_column":0}]}},"filename":"hello.k","line":22,"column":4,"end_line":24,"end_column":5}]}},"filename":"hello.k","line":22,"column":4,"end_line":24,"end_column":5}],"decorators":[],"checks":[{"node":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":27,"column":8,"end_line":27,"end_column":9},"ops":["Gt"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":27,"column":12,"end_line":27,"end_column":13}]}},"filename":"hello.k","line":27,"column":8,"end_line":27,"end_column":13},"if_cond":null,"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"msg\"","value":"msg"}},"filename":"hello.k","line":27,"column":15,"end_line":27,"end_column":20}},"filename":"hello.k","line":27,"column":8,"end_line":27,"end_column":20},{"node":{"test":{"node":{"Identifier":{"names":["name"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":28,"column":8,"end_line":28,"end_column":12},"if_cond":null,"msg":null},"filename":"hello.k","line":28,"column":8,"end_line":28,"end_column":12},{"node":{"test":{"node":{"Unary":{"op":"Not","operand":{"node":{"NameConstantLit":{"value":"None"}},"filename":"hello.k","line":28,"column":17,"end_line":28,"end_column":21}}},"filename":"hello.k","line":28,"column":13,"end_line":28,"end_column":21},"if_cond":null,"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"we fail here\"","value":"we fail here"}},"filename":"hello.k","line":28,"column":23,"end_line":28,"end_column":37}},"filename":"hello.k","line":28,"column":13,"end_line":28,"end_column":37}],"index_signature":{"node":{"key_name":null,"key_type":{"node":"str","filename":"hello.k","line":7,"column":8,"end_line":7,"end_column":11},"value_type":{"node":"int","filename":"hello.k","line":7,"column":14,"end_line":7,"end_column":17},"value":null,"any_other":true,"value_ty":{"node":{"Basic":"Int"},"filename":"hello.k","line":7,"column":14,"end_line":7,"end_column":17}},"filename":"hello.k","line":7,"column":4,"end_line":8,"end_column":0}}},"filename":"hello.k","line":2,"column":0,"end_line":29,"end_column":8}],"comments":[]} + {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Schema":{"doc":"","name":{"node":"TestBool","filename":"hello.k","line":2,"column":7,"end_line":2,"end_column":15},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[],"ctx":"Load"}},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":6}]}},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":6},{"node":{"SchemaAttr":{"doc":"","name":{"node":"a","filename":"hello.k","line":8,"column":4,"end_line":8,"end_column":5},"type_str":{"node":"int","filename":"hello.k","line":8,"column":7,"end_line":8,"end_column":10},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Int"},"filename":"hello.k","line":8,"column":7,"end_line":8,"end_column":10}}},"filename":"hello.k","line":8,"column":4,"end_line":8,"end_column":10},{"node":{"SchemaAttr":{"doc":"","name":{"node":"b","filename":"hello.k","line":9,"column":4,"end_line":9,"end_column":5},"type_str":{"node":"str","filename":"hello.k","line":9,"column":8,"end_line":9,"end_column":11},"op":null,"value":null,"is_optional":true,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"hello.k","line":9,"column":8,"end_line":9,"end_column":11}}},"filename":"hello.k","line":9,"column":4,"end_line":10,"end_column":0},{"node":{"SchemaAttr":{"doc":"","name":{"node":"c","filename":"hello.k","line":10,"column":4,"end_line":10,"end_column":5},"type_str":{"node":"int","filename":"hello.k","line":10,"column":7,"end_line":10,"end_column":10},"op":{"Aug":"Assign"},"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":0}}},"filename":"hello.k","line":10,"column":13,"end_line":10,"end_column":14},"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Int"},"filename":"hello.k","line":10,"column":7,"end_line":10,"end_column":10}}},"filename":"hello.k","line":10,"column":4,"end_line":10,"end_column":14},{"node":{"SchemaAttr":{"doc":"","name":{"node":"d","filename":"hello.k","line":11,"column":4,"end_line":11,"end_column":5},"type_str":{"node":"str","filename":"hello.k","line":11,"column":8,"end_line":11,"end_column":11},"op":{"Aug":"Assign"},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"\"","value":""}},"filename":"hello.k","line":11,"column":14,"end_line":11,"end_column":16},"is_optional":true,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"hello.k","line":11,"column":8,"end_line":11,"end_column":11}}},"filename":"hello.k","line":11,"column":4,"end_line":13,"end_column":0},{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":13,"column":5,"end_line":13,"end_column":6}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":13,"column":5,"end_line":13,"end_column":6}],"ctx":"Load"}},"filename":"hello.k","line":13,"column":4,"end_line":13,"end_column":7}]}},"filename":"hello.k","line":13,"column":4,"end_line":13,"end_column":7},{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":14,"column":5,"end_line":14,"end_column":6}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":14,"column":5,"end_line":14,"end_column":6},{"node":{"Identifier":{"names":[{"node":"b","filename":"hello.k","line":14,"column":8,"end_line":14,"end_column":9}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":14,"column":8,"end_line":14,"end_column":9},{"node":{"Identifier":{"names":[{"node":"c","filename":"hello.k","line":14,"column":11,"end_line":14,"end_column":12}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":14,"column":11,"end_line":14,"end_column":12}],"ctx":"Load"}},"filename":"hello.k","line":14,"column":4,"end_line":14,"end_column":13}]}},"filename":"hello.k","line":14,"column":4,"end_line":14,"end_column":13},{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":16,"column":8,"end_line":16,"end_column":9}],"ctx":"Load"}},"filename":"hello.k","line":15,"column":4,"end_line":17,"end_column":5}]}},"filename":"hello.k","line":15,"column":4,"end_line":17,"end_column":5},{"node":{"Expr":{"exprs":[{"node":{"List":{"elts":[{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":19,"column":8,"end_line":19,"end_column":9}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":19,"column":8,"end_line":19,"end_column":9}],"ctx":"Load"}},"filename":"hello.k","line":18,"column":4,"end_line":20,"end_column":5}]}},"filename":"hello.k","line":18,"column":4,"end_line":20,"end_column":5},{"node":{"Expr":{"exprs":[{"node":{"ListComp":{"elt":{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":21,"column":5,"end_line":21,"end_column":6}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":21,"column":5,"end_line":21,"end_column":6},"generators":[{"node":{"targets":[{"node":{"names":[{"node":"a","filename":"hello.k","line":21,"column":11,"end_line":21,"end_column":12}],"pkgpath":"","ctx":"Load"},"filename":"hello.k","line":21,"column":11,"end_line":21,"end_column":12}],"iter":{"node":{"List":{"elts":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":21,"column":17,"end_line":21,"end_column":18},{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"hello.k","line":21,"column":20,"end_line":21,"end_column":21},{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"hello.k","line":21,"column":23,"end_line":21,"end_column":24}],"ctx":"Load"}},"filename":"hello.k","line":21,"column":16,"end_line":21,"end_column":25},"ifs":[]},"filename":"hello.k","line":21,"column":7,"end_line":21,"end_column":25}]}},"filename":"hello.k","line":21,"column":4,"end_line":21,"end_column":26}]}},"filename":"hello.k","line":21,"column":4,"end_line":21,"end_column":26},{"node":{"Expr":{"exprs":[{"node":{"ListComp":{"elt":{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":23,"column":8,"end_line":23,"end_column":9}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":23,"column":8,"end_line":23,"end_column":9},"generators":[{"node":{"targets":[{"node":{"names":[{"node":"a","filename":"hello.k","line":23,"column":14,"end_line":23,"end_column":15}],"pkgpath":"","ctx":"Load"},"filename":"hello.k","line":23,"column":14,"end_line":23,"end_column":15}],"iter":{"node":{"List":{"elts":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":23,"column":20,"end_line":23,"end_column":21},{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"hello.k","line":23,"column":23,"end_line":23,"end_column":24},{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"hello.k","line":23,"column":26,"end_line":23,"end_column":27}],"ctx":"Load"}},"filename":"hello.k","line":23,"column":19,"end_line":23,"end_column":28},"ifs":[]},"filename":"hello.k","line":23,"column":10,"end_line":24,"end_column":0}]}},"filename":"hello.k","line":22,"column":4,"end_line":24,"end_column":5}]}},"filename":"hello.k","line":22,"column":4,"end_line":24,"end_column":5}],"decorators":[],"checks":[{"node":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":27,"column":8,"end_line":27,"end_column":9}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":27,"column":8,"end_line":27,"end_column":9},"ops":["Gt"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":27,"column":12,"end_line":27,"end_column":13}]}},"filename":"hello.k","line":27,"column":8,"end_line":27,"end_column":13},"if_cond":null,"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"msg\"","value":"msg"}},"filename":"hello.k","line":27,"column":15,"end_line":27,"end_column":20}},"filename":"hello.k","line":27,"column":8,"end_line":27,"end_column":20},{"node":{"test":{"node":{"Identifier":{"names":[{"node":"name","filename":"hello.k","line":28,"column":8,"end_line":28,"end_column":12}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":28,"column":8,"end_line":28,"end_column":12},"if_cond":null,"msg":null},"filename":"hello.k","line":28,"column":8,"end_line":28,"end_column":12},{"node":{"test":{"node":{"Unary":{"op":"Not","operand":{"node":{"NameConstantLit":{"value":"None"}},"filename":"hello.k","line":28,"column":17,"end_line":28,"end_column":21}}},"filename":"hello.k","line":28,"column":13,"end_line":28,"end_column":21},"if_cond":null,"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"we fail here\"","value":"we fail here"}},"filename":"hello.k","line":28,"column":23,"end_line":28,"end_column":37}},"filename":"hello.k","line":28,"column":13,"end_line":28,"end_column":37}],"index_signature":{"node":{"key_name":null,"key_type":{"node":"str","filename":"hello.k","line":7,"column":8,"end_line":7,"end_column":11},"value_type":{"node":"int","filename":"hello.k","line":7,"column":14,"end_line":7,"end_column":17},"value":null,"any_other":true,"value_ty":{"node":{"Basic":"Int"},"filename":"hello.k","line":7,"column":14,"end_line":7,"end_column":17}},"filename":"hello.k","line":7,"column":4,"end_line":8,"end_column":0}}},"filename":"hello.k","line":2,"column":0,"end_line":29,"end_column":8}],"comments":[]} "#]], ); } @@ -1142,7 +1142,7 @@ fn test_parse_joined_string() { check_parsing_expr( r####"'abc${a+1}cde'"####, expect![[r#" - Node { node: JoinedString(JoinedString { is_long_string: false, values: [Node { node: StringLit(StringLit { is_long_string: false, raw_value: "abc", value: "abc" }), filename: "", line: 1, column: 1, end_line: 1, end_column: 1 }, Node { node: FormattedValue(FormattedValue { is_long_string: false, value: Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }, op: Bin(Add), right: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 } }), filename: "", line: 1, column: 6, end_line: 1, end_column: 9 }, format_spec: None }), filename: "", line: 1, column: 6, end_line: 1, end_column: 9 }, Node { node: StringLit(StringLit { is_long_string: false, raw_value: "cde", value: "cde" }), filename: "", line: 1, column: 1, end_line: 1, end_column: 1 }], raw_value: "'abc${a+1}cde'" }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 } + Node { node: JoinedString(JoinedString { is_long_string: false, values: [Node { node: StringLit(StringLit { is_long_string: false, raw_value: "abc", value: "abc" }), filename: "", line: 1, column: 1, end_line: 1, end_column: 1 }, Node { node: FormattedValue(FormattedValue { is_long_string: false, value: Node { node: Binary(BinaryExpr { left: Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 6, end_line: 1, end_column: 7 }, op: Bin(Add), right: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 1, column: 8, end_line: 1, end_column: 9 } }), filename: "", line: 1, column: 6, end_line: 1, end_column: 9 }, format_spec: None }), filename: "", line: 1, column: 6, end_line: 1, end_column: 9 }, Node { node: StringLit(StringLit { is_long_string: false, raw_value: "cde", value: "cde" }), filename: "", line: 1, column: 1, end_line: 1, end_column: 1 }], raw_value: "'abc${a+1}cde'" }), filename: "", line: 1, column: 0, end_line: 1, end_column: 14 } "#]], ); } @@ -1153,7 +1153,7 @@ fn test_parse_assign_stmt() { "hello.k", r####"a=123"####, expect![[r#" - {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":1,"column":0,"end_line":1,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":123}}},"filename":"hello.k","line":1,"column":2,"end_line":1,"end_column":5},"type_annotation":null,"ty":null}},"filename":"hello.k","line":1,"column":0,"end_line":1,"end_column":5}],"comments":[]} + {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"a","filename":"hello.k","line":1,"column":0,"end_line":1,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":1,"column":0,"end_line":1,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":123}}},"filename":"hello.k","line":1,"column":2,"end_line":1,"end_column":5},"type_annotation":null,"ty":null}},"filename":"hello.k","line":1,"column":0,"end_line":1,"end_column":5}],"comments":[]} "#]], ); } @@ -1171,7 +1171,7 @@ elif a == 10 and b == 12: _condition = 2 condition = _condition "####, expect![[r#" - {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":10}}},"filename":"hello.k","line":2,"column":4,"end_line":2,"end_column":6},"type_annotation":null,"ty":null}},"filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":6},{"node":{"Assign":{"targets":[{"node":{"names":["b"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":12}}},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":6},"type_annotation":null,"ty":null}},"filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":6},{"node":{"Assign":{"targets":[{"node":{"names":["_condition"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":4,"column":0,"end_line":4,"end_column":10}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":0}}},"filename":"hello.k","line":4,"column":13,"end_line":4,"end_column":14},"type_annotation":null,"ty":null}},"filename":"hello.k","line":4,"column":0,"end_line":4,"end_column":14},{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":["_condition"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":5,"column":23,"end_line":5,"end_column":33}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":5,"column":36,"end_line":5,"end_column":37},"type_annotation":null,"ty":null}},"filename":"hello.k","line":5,"column":23,"end_line":5,"end_column":37}],"cond":{"node":{"Binary":{"left":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":5,"column":3,"end_line":5,"end_column":4},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":11}}},"filename":"hello.k","line":5,"column":8,"end_line":5,"end_column":10}]}},"filename":"hello.k","line":5,"column":3,"end_line":5,"end_column":21},"op":{"Bin":"Or"},"right":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["b"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":5,"column":14,"end_line":5,"end_column":15},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":13}}},"filename":"hello.k","line":5,"column":19,"end_line":5,"end_column":21}]}},"filename":"hello.k","line":5,"column":14,"end_line":5,"end_column":21}}},"filename":"hello.k","line":5,"column":3,"end_line":5,"end_column":21},"orelse":[{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":["_condition"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":6,"column":26,"end_line":6,"end_column":36}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"hello.k","line":6,"column":39,"end_line":6,"end_column":40},"type_annotation":null,"ty":null}},"filename":"hello.k","line":6,"column":26,"end_line":6,"end_column":40}],"cond":{"node":{"Binary":{"left":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":6,"column":5,"end_line":6,"end_column":6},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":10}}},"filename":"hello.k","line":6,"column":10,"end_line":6,"end_column":12}]}},"filename":"hello.k","line":6,"column":5,"end_line":6,"end_column":24},"op":{"Bin":"And"},"right":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["b"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":6,"column":17,"end_line":6,"end_column":18},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":12}}},"filename":"hello.k","line":6,"column":22,"end_line":6,"end_column":24}]}},"filename":"hello.k","line":6,"column":17,"end_line":6,"end_column":24}}},"filename":"hello.k","line":6,"column":5,"end_line":6,"end_column":24},"orelse":[]}},"filename":"hello.k","line":6,"column":0,"end_line":7,"end_column":0}]}},"filename":"hello.k","line":5,"column":0,"end_line":7,"end_column":0},{"node":{"Assign":{"targets":[{"node":{"names":["condition"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":9}],"value":{"node":{"Identifier":{"names":["_condition"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":7,"column":12,"end_line":7,"end_column":22},"type_annotation":null,"ty":null}},"filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":22}],"comments":[]} + {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"a","filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":10}}},"filename":"hello.k","line":2,"column":4,"end_line":2,"end_column":6},"type_annotation":null,"ty":null}},"filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":6},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"b","filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":12}}},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":6},"type_annotation":null,"ty":null}},"filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":6},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_condition","filename":"hello.k","line":4,"column":0,"end_line":4,"end_column":10}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":4,"column":0,"end_line":4,"end_column":10}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":0}}},"filename":"hello.k","line":4,"column":13,"end_line":4,"end_column":14},"type_annotation":null,"ty":null}},"filename":"hello.k","line":4,"column":0,"end_line":4,"end_column":14},{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_condition","filename":"hello.k","line":5,"column":23,"end_line":5,"end_column":33}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":5,"column":23,"end_line":5,"end_column":33}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":5,"column":36,"end_line":5,"end_column":37},"type_annotation":null,"ty":null}},"filename":"hello.k","line":5,"column":23,"end_line":5,"end_column":37}],"cond":{"node":{"Binary":{"left":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":5,"column":3,"end_line":5,"end_column":4}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":5,"column":3,"end_line":5,"end_column":4},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":11}}},"filename":"hello.k","line":5,"column":8,"end_line":5,"end_column":10}]}},"filename":"hello.k","line":5,"column":3,"end_line":5,"end_column":21},"op":{"Bin":"Or"},"right":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"b","filename":"hello.k","line":5,"column":14,"end_line":5,"end_column":15}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":5,"column":14,"end_line":5,"end_column":15},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":13}}},"filename":"hello.k","line":5,"column":19,"end_line":5,"end_column":21}]}},"filename":"hello.k","line":5,"column":14,"end_line":5,"end_column":21}}},"filename":"hello.k","line":5,"column":3,"end_line":5,"end_column":21},"orelse":[{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_condition","filename":"hello.k","line":6,"column":26,"end_line":6,"end_column":36}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":6,"column":26,"end_line":6,"end_column":36}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"hello.k","line":6,"column":39,"end_line":6,"end_column":40},"type_annotation":null,"ty":null}},"filename":"hello.k","line":6,"column":26,"end_line":6,"end_column":40}],"cond":{"node":{"Binary":{"left":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":6,"column":5,"end_line":6,"end_column":6}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":6,"column":5,"end_line":6,"end_column":6},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":10}}},"filename":"hello.k","line":6,"column":10,"end_line":6,"end_column":12}]}},"filename":"hello.k","line":6,"column":5,"end_line":6,"end_column":24},"op":{"Bin":"And"},"right":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"b","filename":"hello.k","line":6,"column":17,"end_line":6,"end_column":18}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":6,"column":17,"end_line":6,"end_column":18},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":12}}},"filename":"hello.k","line":6,"column":22,"end_line":6,"end_column":24}]}},"filename":"hello.k","line":6,"column":17,"end_line":6,"end_column":24}}},"filename":"hello.k","line":6,"column":5,"end_line":6,"end_column":24},"orelse":[]}},"filename":"hello.k","line":6,"column":0,"end_line":7,"end_column":0}]}},"filename":"hello.k","line":5,"column":0,"end_line":7,"end_column":0},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"condition","filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":9}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":9}],"value":{"node":{"Identifier":{"names":[{"node":"_condition","filename":"hello.k","line":7,"column":12,"end_line":7,"end_column":22}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":7,"column":12,"end_line":7,"end_column":22},"type_annotation":null,"ty":null}},"filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":22}],"comments":[]} "#]], ); @@ -1184,8 +1184,8 @@ data2 = { } "####, expect![[r#" - {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["data2"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":5}],"value":{"node":{"Config":{"items":[{"node":{"key":null,"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["key"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":3,"column":7,"end_line":3,"end_column":10},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"value1\"","value":"value1"}},"filename":"hello.k","line":3,"column":13,"end_line":3,"end_column":21},"operation":"Override","insert_index":-1},"filename":"hello.k","line":3,"column":7,"end_line":3,"end_column":21}]}},"filename":"hello.k","line":3,"column":6,"end_line":3,"end_column":22},"operation":"Union","insert_index":-1},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":22},{"node":{"key":null,"value":{"node":{"ConfigIfEntry":{"if_cond":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":4,"column":7,"end_line":4,"end_column":8},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":123}}},"filename":"hello.k","line":4,"column":12,"end_line":4,"end_column":15}]}},"filename":"hello.k","line":4,"column":7,"end_line":4,"end_column":15},"items":[{"node":{"key":null,"value":{"node":{"ConfigIfEntry":{"if_cond":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["b"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":4,"column":20,"end_line":4,"end_column":21},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":456}}},"filename":"hello.k","line":4,"column":25,"end_line":4,"end_column":28}]}},"filename":"hello.k","line":4,"column":20,"end_line":4,"end_column":28},"items":[{"node":{"key":{"node":{"Identifier":{"names":["key"],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":4,"column":30,"end_line":4,"end_column":33},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"value2\"","value":"value2"}},"filename":"hello.k","line":4,"column":36,"end_line":4,"end_column":44},"operation":"Override","insert_index":-1},"filename":"hello.k","line":4,"column":36,"end_line":4,"end_column":44}],"orelse":null}},"filename":"hello.k","line":4,"column":30,"end_line":4,"end_column":44},"operation":"Override","insert_index":-1},"filename":"hello.k","line":4,"column":30,"end_line":4,"end_column":44}],"orelse":null}},"filename":"hello.k","line":4,"column":17,"end_line":5,"end_column":0},"operation":"Union","insert_index":-1},"filename":"hello.k","line":4,"column":4,"end_line":5,"end_column":0}]}},"filename":"hello.k","line":2,"column":8,"end_line":5,"end_column":1},"type_annotation":null,"ty":null}},"filename":"hello.k","line":2,"column":0,"end_line":5,"end_column":1}],"comments":[]} - "#]], + {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"data2","filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":5}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":5}],"value":{"node":{"Config":{"items":[{"node":{"key":null,"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"key","filename":"hello.k","line":3,"column":7,"end_line":3,"end_column":10}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":3,"column":7,"end_line":3,"end_column":10},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"value1\"","value":"value1"}},"filename":"hello.k","line":3,"column":13,"end_line":3,"end_column":21},"operation":"Override","insert_index":-1},"filename":"hello.k","line":3,"column":7,"end_line":3,"end_column":21}]}},"filename":"hello.k","line":3,"column":6,"end_line":3,"end_column":22},"operation":"Union","insert_index":-1},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":22},{"node":{"key":null,"value":{"node":{"ConfigIfEntry":{"if_cond":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"a","filename":"hello.k","line":4,"column":7,"end_line":4,"end_column":8}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":4,"column":7,"end_line":4,"end_column":8},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":123}}},"filename":"hello.k","line":4,"column":12,"end_line":4,"end_column":15}]}},"filename":"hello.k","line":4,"column":7,"end_line":4,"end_column":15},"items":[{"node":{"key":null,"value":{"node":{"ConfigIfEntry":{"if_cond":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"b","filename":"hello.k","line":4,"column":20,"end_line":4,"end_column":21}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":4,"column":20,"end_line":4,"end_column":21},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":456}}},"filename":"hello.k","line":4,"column":25,"end_line":4,"end_column":28}]}},"filename":"hello.k","line":4,"column":20,"end_line":4,"end_column":28},"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"key","filename":"hello.k","line":4,"column":30,"end_line":4,"end_column":33}],"pkgpath":"","ctx":"Load"}},"filename":"hello.k","line":4,"column":30,"end_line":4,"end_column":33},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"value2\"","value":"value2"}},"filename":"hello.k","line":4,"column":36,"end_line":4,"end_column":44},"operation":"Override","insert_index":-1},"filename":"hello.k","line":4,"column":36,"end_line":4,"end_column":44}],"orelse":null}},"filename":"hello.k","line":4,"column":30,"end_line":4,"end_column":44},"operation":"Override","insert_index":-1},"filename":"hello.k","line":4,"column":30,"end_line":4,"end_column":44}],"orelse":null}},"filename":"hello.k","line":4,"column":17,"end_line":5,"end_column":0},"operation":"Union","insert_index":-1},"filename":"hello.k","line":4,"column":4,"end_line":5,"end_column":0}]}},"filename":"hello.k","line":2,"column":8,"end_line":5,"end_column":1},"type_annotation":null,"ty":null}},"filename":"hello.k","line":2,"column":0,"end_line":5,"end_column":1}],"comments":[]} + "#]], ); check_parsing_file_ast_json( @@ -1199,7 +1199,7 @@ b = 2 c = 3 # comment4444 "####, expect![[r###" - {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":5},"type_annotation":null,"ty":null}},"filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":5},{"node":{"Assign":{"targets":[{"node":{"names":["b"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":5,"column":0,"end_line":5,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"hello.k","line":5,"column":4,"end_line":5,"end_column":5},"type_annotation":null,"ty":null}},"filename":"hello.k","line":5,"column":0,"end_line":5,"end_column":5},{"node":{"Assign":{"targets":[{"node":{"names":["c"],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"hello.k","line":7,"column":4,"end_line":7,"end_column":5},"type_annotation":null,"ty":null}},"filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":5}],"comments":[{"node":{"text":"# comment1"},"filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":10},{"node":{"text":"# comment22"},"filename":"hello.k","line":4,"column":0,"end_line":4,"end_column":11},{"node":{"text":"# comment333"},"filename":"hello.k","line":6,"column":0,"end_line":6,"end_column":12},{"node":{"text":"# comment4444"},"filename":"hello.k","line":7,"column":6,"end_line":7,"end_column":19}]} + {"filename":"hello.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"a","filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"hello.k","line":3,"column":4,"end_line":3,"end_column":5},"type_annotation":null,"ty":null}},"filename":"hello.k","line":3,"column":0,"end_line":3,"end_column":5},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"b","filename":"hello.k","line":5,"column":0,"end_line":5,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":5,"column":0,"end_line":5,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"hello.k","line":5,"column":4,"end_line":5,"end_column":5},"type_annotation":null,"ty":null}},"filename":"hello.k","line":5,"column":0,"end_line":5,"end_column":5},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"c","filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"hello.k","line":7,"column":4,"end_line":7,"end_column":5},"type_annotation":null,"ty":null}},"filename":"hello.k","line":7,"column":0,"end_line":7,"end_column":5}],"comments":[{"node":{"text":"# comment1"},"filename":"hello.k","line":2,"column":0,"end_line":2,"end_column":10},{"node":{"text":"# comment22"},"filename":"hello.k","line":4,"column":0,"end_line":4,"end_column":11},{"node":{"text":"# comment333"},"filename":"hello.k","line":6,"column":0,"end_line":6,"end_column":12},{"node":{"text":"# comment4444"},"filename":"hello.k","line":7,"column":6,"end_line":7,"end_column":19}]} "###]], ); } @@ -1361,7 +1361,7 @@ fn expr_with_brace1() { check_parsing_expr( r####"{a=2}"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 1, end_line: 1, end_column: 4 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 1, end_line: 1, end_column: 4 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } "#]], ); } @@ -1371,7 +1371,7 @@ fn expr_with_brace2() { check_parsing_expr( r####"{a=2}}"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 1, end_line: 1, end_column: 4 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 3, end_line: 1, end_column: 4 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 1, end_line: 1, end_column: 4 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 5 } "#]], ); } @@ -1381,7 +1381,7 @@ fn expr_with_delim1() { check_parsing_expr( r####"({a=2}"####, expect![[r#" - Node { node: Paren(ParenExpr { expr: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 2, end_line: 1, end_column: 5 }] }), filename: "", line: 1, column: 1, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Paren(ParenExpr { expr: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 2, end_line: 1, end_column: 5 }] }), filename: "", line: 1, column: 1, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); } @@ -1391,7 +1391,7 @@ fn expr_with_delim2() { check_parsing_expr( r####"({a=(2}"####, expect![[r#" - Node { node: Paren(ParenExpr { expr: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), value: Node { node: Paren(ParenExpr { expr: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 4, end_line: 1, end_column: 7 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 2, end_line: 1, end_column: 7 }] }), filename: "", line: 1, column: 1, end_line: 1, end_column: 7 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } + Node { node: Paren(ParenExpr { expr: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), value: Node { node: Paren(ParenExpr { expr: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 } }), filename: "", line: 1, column: 4, end_line: 1, end_column: 7 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 2, end_line: 1, end_column: 7 }] }), filename: "", line: 1, column: 1, end_line: 1, end_column: 7 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } "#]], ); } @@ -1401,7 +1401,7 @@ fn expr_with_delim3() { check_parsing_expr( r####"{a=[2]"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }), value: Node { node: List(ListExpr { elts: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], ctx: Load }), filename: "", line: 1, column: 3, end_line: 1, end_column: 6 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 1, end_line: 1, end_column: 6 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 1, end_line: 1, end_column: 2 }), value: Node { node: List(ListExpr { elts: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }], ctx: Load }), filename: "", line: 1, column: 3, end_line: 1, end_column: 6 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 1, end_line: 1, end_column: 6 }] }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); } @@ -1411,7 +1411,7 @@ fn expr_with_delim4() { check_parsing_expr( r####"[{a=2}"####, expect![[r#" - Node { node: List(ListExpr { elts: [Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 2, end_line: 1, end_column: 5 }] }), filename: "", line: 1, column: 1, end_line: 1, end_column: 6 }], ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } + Node { node: List(ListExpr { elts: [Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 4, end_line: 1, end_column: 5 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 2, end_line: 1, end_column: 5 }] }), filename: "", line: 1, column: 1, end_line: 1, end_column: 6 }], ctx: Load }), filename: "", line: 1, column: 0, end_line: 1, end_column: 6 } "#]], ); } @@ -1421,7 +1421,7 @@ fn expr_with_delim5() { check_parsing_expr( r####"({a=[2}"####, expect![[r#" - Node { node: Paren(ParenExpr { expr: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), value: Node { node: List(ListExpr { elts: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }], ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 7 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 2, end_line: 1, end_column: 7 }] }), filename: "", line: 1, column: 1, end_line: 1, end_column: 7 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } + Node { node: Paren(ParenExpr { expr: Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }], pkgpath: "", ctx: Load }), filename: "", line: 1, column: 2, end_line: 1, end_column: 3 }), value: Node { node: List(ListExpr { elts: [Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(2) }), filename: "", line: 1, column: 5, end_line: 1, end_column: 6 }], ctx: Load }), filename: "", line: 1, column: 4, end_line: 1, end_column: 7 }, operation: Override, insert_index: -1 }, filename: "", line: 1, column: 2, end_line: 1, end_column: 7 }] }), filename: "", line: 1, column: 1, end_line: 1, end_column: 7 } }), filename: "", line: 1, column: 0, end_line: 1, end_column: 7 } "#]], ); } @@ -1443,7 +1443,7 @@ fn expr_with_delim7() { a = 1 }"####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 2, column: 8, end_line: 2, end_column: 9 }, operation: Override, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 2, end_column: 9 }] }), filename: "", line: 1, column: 0, end_line: 3, end_column: 1 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 2, column: 8, end_line: 2, end_column: 9 }, operation: Override, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 2, end_column: 9 }] }), filename: "", line: 1, column: 0, end_line: 3, end_column: 1 } "#]], ); } @@ -1455,7 +1455,7 @@ fn expr_with_delim8() { a = 1 "####, expect![[r#" - Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: ["a"], pkgpath: "", ctx: Load }), filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 2, column: 8, end_line: 2, end_column: 9 }, operation: Override, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 2, end_column: 9 }] }), filename: "", line: 1, column: 0, end_line: 2, end_column: 10 } + Node { node: Config(ConfigExpr { items: [Node { node: ConfigEntry { key: Some(Node { node: Identifier(Identifier { names: [Node { node: "a", filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }], pkgpath: "", ctx: Load }), filename: "", line: 2, column: 4, end_line: 2, end_column: 5 }), value: Node { node: NumberLit(NumberLit { binary_suffix: None, value: Int(1) }), filename: "", line: 2, column: 8, end_line: 2, end_column: 9 }, operation: Override, insert_index: -1 }, filename: "", line: 2, column: 4, end_line: 2, end_column: 9 }] }), filename: "", line: 1, column: 0, end_line: 2, end_column: 10 } "#]], ); } diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assert_stmt_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assert_stmt_recovery_1.snap index 4c1772cb4..86230afe9 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assert_stmt_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assert_stmt_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 157 expression: "crate::tests::parsing_module_string(r#\"assert a.\"#)" --- Module { @@ -16,8 +15,22 @@ Module { node: Identifier( Identifier { names: [ - "a", - "", + Node { + node: "a", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, + Node { + node: "", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 9, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assert_stmt_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assert_stmt_recovery_3.snap index ef733ae31..80a0d8438 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assert_stmt_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assert_stmt_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 159 expression: "crate::tests::parsing_module_string(r#\"assert True if data else 'msg'\"#)" --- Module { @@ -29,7 +28,14 @@ Module { node: Identifier( Identifier { names: [ - "data", + Node { + node: "data", + filename: "", + line: 1, + column: 15, + end_line: 1, + end_column: 19, + }, ], pkgpath: "", ctx: Load, @@ -59,7 +65,14 @@ Module { node: Identifier( Identifier { names: [ - "else", + Node { + node: "else", + filename: "", + line: 1, + column: 20, + end_line: 1, + end_column: 24, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_0.snap index 816185317..4f67ff5db 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_0.snap @@ -15,7 +15,14 @@ Module { Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Store, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_2.snap index 574e5a445..341bd0647 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_2.snap @@ -15,7 +15,14 @@ Module { Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Store, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_3.snap index cf3936b8e..0ae6a0afa 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 148 expression: "crate::tests::parsing_module_string(r#\"a: a = 1\"#)" --- Module { @@ -16,7 +15,14 @@ Module { Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Store, @@ -58,7 +64,14 @@ Module { node: Named( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_5.snap index f43dd11fe..c680b8227 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_5.snap @@ -15,7 +15,14 @@ Module { Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Store, @@ -29,7 +36,14 @@ Module { Node { node: Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 5, + }, ], pkgpath: "", ctx: Store, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_6.snap index ac01fe91c..d5b28116a 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__assign_stmt_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 151 expression: "crate::tests::parsing_module_string(r#\"a() = b. = c\"#)" --- Module { @@ -28,8 +27,22 @@ Module { Node { node: Identifier { names: [ - "b", - "", + Node { + node: "b", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, + Node { + node: "", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 9, + }, ], pkgpath: "", ctx: Store, @@ -45,7 +58,14 @@ Module { node: Identifier( Identifier { names: [ - "c", + Node { + node: "c", + filename: "", + line: 1, + column: 11, + end_line: 1, + end_column: 12, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_0.snap index 3b1bef3ac..bd7c6ee1d 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_0.snap @@ -1,13 +1,19 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 63 expression: "crate::tests::parsing_expr_string(r#\"a not is b\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_1.snap index 486f01f7a..c216df331 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 64 expression: "crate::tests::parsing_expr_string(r#\"a is is not b\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -30,7 +36,14 @@ Node { node: Identifier( Identifier { names: [ - "is", + Node { + node: "is", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_2.snap index 4c6aa7372..977b93b43 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_2.snap @@ -1,13 +1,19 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 65 expression: "crate::tests::parsing_expr_string(r#\"a not b\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_3.snap index 1adbcb8ba..bf68b34e3 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_3.snap @@ -1,13 +1,19 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 66 expression: "crate::tests::parsing_expr_string(r#\"a not is in b\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_4.snap index d92242b9e..d4b9948ff 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 67 expression: "crate::tests::parsing_expr_string(r#\"a in in b\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -30,7 +36,14 @@ Node { node: Identifier( Identifier { names: [ - "in", + Node { + node: "in", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_5.snap index 50f32141c..3b3317cca 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 68 expression: "crate::tests::parsing_expr_string(r#\"a ++ b\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -33,7 +39,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_6.snap index 6e7ca10ed..d2e237193 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_6.snap @@ -12,7 +12,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -64,7 +71,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 8, + end_line: 1, + end_column: 9, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_7.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_7.snap index 15d1d32d6..ffa4d8b58 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_7.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_7.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 70 expression: "crate::tests::parsing_expr_string(r#\"a +is b\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -29,7 +35,14 @@ Node { node: Identifier( Identifier { names: [ - "is", + Node { + node: "is", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 5, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_8.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_8.snap index 6f758f811..e76e3f815 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_8.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__binary_recovery_8.snap @@ -1,13 +1,19 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 71 expression: "crate::tests::parsing_expr_string(r#\"a +=+ b\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_0.snap index 6eecf95e2..765f62e31 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_0.snap @@ -9,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_1.snap index a816d63c6..bdfd9fb5a 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 113 expression: "crate::tests::parsing_expr_string(r#\"a(]\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_2.snap index f7a79b3b3..f6572f600 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_2.snap @@ -9,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -26,7 +33,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_3.snap index 25be34297..e853ca663 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 115 expression: "crate::tests::parsing_expr_string(r#\"a.b(a=1,2)\"#)" --- Node { @@ -10,8 +9,22 @@ Node { node: Identifier( Identifier { names: [ - "a", - "b", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, + Node { + node: "b", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, @@ -46,7 +59,14 @@ Node { arg: Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 5, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_4.snap index b6f4e6236..174c24666 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 116 expression: "crate::tests::parsing_expr_string(r#\"a(a.ba=1,2)\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -45,8 +51,22 @@ Node { arg: Node { node: Identifier { names: [ - "a", - "ba", + Node { + node: "a", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, + Node { + node: "ba", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_5.snap index fb4911774..b279a496b 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 117 expression: "crate::tests::parsing_expr_string(r#\"a(a.b+a=1,2)\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_6.snap index de789f580..0b7e629f4 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 118 expression: "crate::tests::parsing_expr_string(r#\"a(a-1.b=1)\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_7.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_7.snap index 723bad9e6..064b56799 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_7.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__call_recovery_7.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 144 expression: "crate::tests::parsing_expr_string(r#\"a(type=\"list\", \"key\")\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -44,7 +50,14 @@ Node { arg: Node { node: Identifier { names: [ - "type", + Node { + node: "type", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_0.snap index 2c3b84950..8a232b432 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_0.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 71 expression: "crate::tests::parsing_expr_string(\"[i for i in [1,2,3]]\")" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -29,7 +35,14 @@ Node { Node { node: Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_1.snap index eb394815c..4d07d7700 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 72 expression: "crate::tests::parsing_expr_string(\"[i, j for i in [1,2,3]]\")" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -29,7 +35,14 @@ Node { Node { node: Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 10, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_3.snap index 0df1e55ad..823289713 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 74 expression: "crate::tests::parsing_expr_string(\"{i for i in [1,2,3]}\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -34,7 +40,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_4.snap index d6f5f4cdb..5f23dacbc 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 75 expression: "crate::tests::parsing_expr_string(\"{i: for i in [1,2,3]}\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -31,7 +37,14 @@ Node { node: Identifier( Identifier { names: [ - "for", + Node { + node: "for", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, @@ -62,7 +75,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 8, + end_line: 1, + end_column: 9, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_5.snap index 0bf399bf3..5f6f6520e 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__comp_clause_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 76 expression: "crate::tests::parsing_expr_string(\"{i: 1, j for i in [1,2,3]}\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -58,7 +64,14 @@ Node { node: Identifier( Identifier { names: [ - "j", + Node { + node: "j", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, @@ -78,7 +91,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 13, + end_line: 1, + end_column: 14, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_0.snap index dd7b2ca60..a64d0b4e7 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_0.snap @@ -9,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -40,7 +47,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_1.snap index 5fdafedad..d75e31cfd 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 73 expression: "crate::tests::parsing_expr_string(r#\"a < !b >!1\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -35,7 +41,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_2.snap index d9abd32f9..d75e31cfd 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_2.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 74 expression: "crate::tests::parsing_expr_string(r#\"a < !b >!1\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -35,7 +41,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_3.snap index f89c3c9c4..0e59edb63 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_3.snap @@ -12,7 +12,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -53,7 +60,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_4.snap index 63861ae45..180757482 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_4.snap @@ -9,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -52,7 +59,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_5.snap index 2a8dcf32d..3b231aeec 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 77 expression: "crate::tests::parsing_expr_string(r#\"a >+ b\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -34,7 +40,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_6.snap index 48a874d6a..d0df0d26a 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__compare_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 78 expression: "crate::tests::parsing_expr_string(r#\"+ b\"#)" --- Node { @@ -25,7 +24,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -45,7 +51,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_1.snap index 6ab627e0e..d608c7b68 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 15 expression: "crate::tests::parsing_expr_string(\"{a = 1\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_10.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_10.snap index 7facff34b..b1f1cd86b 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_10.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_10.snap @@ -13,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, @@ -57,7 +64,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_11.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_11.snap index 702db6551..054a988c5 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_11.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_11.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 69 expression: "crate::tests::parsing_expr_string(\"{if True: a = , b = 2}\")" --- Node { @@ -33,7 +32,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 10, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, @@ -91,7 +97,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 16, + end_line: 1, + end_column: 17, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_12.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_12.snap index 897a66ec5..0e5bd8cf9 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_12.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_12.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 70 expression: "crate::tests::parsing_expr_string(\"{if True: *a, b = 2}\")" --- Node { @@ -49,7 +48,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 11, + end_line: 1, + end_column: 12, + }, ], pkgpath: "", ctx: Load, @@ -115,7 +121,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 14, + end_line: 1, + end_column: 15, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_13.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_13.snap index 181c8aff6..2fb72d112 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_13.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_13.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 71 expression: "crate::tests::parsing_expr_string(\"{if True: key: {}}\")" --- Node { @@ -33,7 +32,14 @@ Node { node: Identifier( Identifier { names: [ - "key", + Node { + node: "key", + filename: "", + line: 1, + column: 10, + end_line: 1, + end_column: 13, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_14.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_14.snap index b3db187b9..bca2a5575 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_14.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_14.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 72 expression: "crate::tests::parsing_expr_string(\"{if True: key: []}\")" --- Node { @@ -33,7 +32,14 @@ Node { node: Identifier( Identifier { names: [ - "key", + Node { + node: "key", + filename: "", + line: 1, + column: 10, + end_line: 1, + end_column: 13, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_2.snap index fad62a544..f04db9f45 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_2.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 16 expression: "crate::tests::parsing_expr_string(\"{a = 1, b = 2\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -58,7 +64,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 8, + end_line: 1, + end_column: 9, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_3.snap index 943ef87e2..ffe8fd510 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 17 expression: "crate::tests::parsing_expr_string(\"{a = {a = 1}\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -38,7 +44,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_4.snap index d452826d8..47f298ace 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 18 expression: "crate::tests::parsing_expr_string(\"{a = {a = 1\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -38,7 +44,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_5.snap index 24a8138ce..990340591 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 19 expression: "crate::tests::parsing_expr_string(r#\"{\n a = 1\n b = 2\n \"#)" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 2, + column: 4, + end_line: 2, + end_column: 5, + }, ], pkgpath: "", ctx: Load, @@ -58,7 +64,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 3, + column: 4, + end_line: 3, + end_column: 5, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_6.snap index 65a6b5194..26b784328 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 64 expression: "crate::tests::parsing_expr_string(\"{a = 1 b = 2}\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -58,7 +64,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_7.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_7.snap index 9f2d22cdb..a1b7d7b23 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_7.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_7.snap @@ -13,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -68,7 +75,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 10, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_8.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_8.snap index 6d4b02d17..2ceb8cd02 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_8.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_8.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 66 expression: "crate::tests::parsing_expr_string(\"{a = 1 ~ b = 2}\")" --- Node { @@ -14,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, @@ -62,7 +68,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 10, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_9.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_9.snap index 4341c7db9..e1b3f7712 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_9.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__config_recovery_9.snap @@ -29,7 +29,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, @@ -70,7 +77,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_recovery_4.snap index 7d02a1e8e..ccc877766 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_recovery_4.snap @@ -1,13 +1,19 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 83 expression: "crate::tests::parsing_expr_string(r#\"if True else\"#)" --- Node { node: Identifier( Identifier { names: [ - "if", + Node { + node: "if", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_1.snap index fc49ee799..549e9165e 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 175 expression: "crate::tests::parsing_module_string(r#\"if True: a = 1 else if b = 2\"#)" --- Module { @@ -20,7 +19,14 @@ Module { Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 10, + }, ], pkgpath: "", ctx: Store, @@ -78,7 +84,14 @@ Module { Node { node: Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 23, + end_line: 1, + end_column: 24, + }, ], pkgpath: "", ctx: Store, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_2.snap index b27b13695..110546376 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_2.snap @@ -19,7 +19,14 @@ Module { Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Store, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_3.snap index ddd46d631..ea8e97f43 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_3.snap @@ -19,7 +19,14 @@ Module { Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 10, + }, ], pkgpath: "", ctx: Store, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_4.snap index 8eae18937..31cf280e0 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 178 expression: "crate::tests::parsing_module_string(r#\"if True: else: b = 2\"#)" --- Module { @@ -20,7 +19,14 @@ Module { Node { node: Identifier { names: [ - "else", + Node { + node: "else", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 13, + }, ], pkgpath: "", ctx: Store, @@ -62,7 +68,14 @@ Module { node: Named( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 15, + end_line: 1, + end_column: 16, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_6.snap index 458592bf4..6434d7d08 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__if_stmt_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 180 expression: "crate::tests::parsing_module_string(r#\"if else\"#)" --- Module { @@ -41,7 +40,14 @@ Module { node: Identifier( Identifier { names: [ - "else", + Node { + node: "else", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_1.snap index 1c3dc5d81..d766db909 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 152 expression: "crate::tests::parsing_expr_string(r#\"'${a +}'\"#)" --- Node { @@ -19,7 +18,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_2.snap index 6f2ec641f..52cb08957 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_2.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 153 expression: "crate::tests::parsing_expr_string(r#\"'${(a +}'\"#)" --- Node { @@ -22,7 +21,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 5, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_5.snap index 3fc7db29c..d4cd39402 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 155 expression: "crate::tests::parsing_expr_string(r#\"'${a + 1 = }'\"#)" --- Node { @@ -19,7 +18,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_6.snap index d5e6c8b4d..466ccce34 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__joined_string_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 156 expression: "crate::tests::parsing_expr_string(r#\"'${a: json}'\"#)" --- Node { @@ -16,7 +15,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_10.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_10.snap index 4bc767631..ce623a7e4 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_10.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_10.snap @@ -26,7 +26,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, @@ -53,7 +60,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_11.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_11.snap index 48d5ed406..637195280 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_11.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_11.snap @@ -1,7 +1,6 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 53 -expression: "crate::tests::parsing_expr_string(r#\"[if True: a, b]\"#)" +expression: "crate::tests::parsing_expr_string(\"[if True: a, b]\")" --- Node { node: List( @@ -27,7 +26,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 10, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, @@ -53,7 +59,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 13, + end_line: 1, + end_column: 14, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_12.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_12.snap index 4a397e4be..b7e8f0546 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_12.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_12.snap @@ -42,7 +42,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 12, + end_line: 1, + end_column: 13, + }, ], pkgpath: "", ctx: Load, @@ -76,7 +83,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 15, + end_line: 1, + end_column: 16, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_9.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_9.snap index 2b65148ce..1aeb4ed09 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_9.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__list_recovery_9.snap @@ -13,7 +13,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, @@ -54,7 +61,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_0.snap index b8047cb25..658e897e8 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_0.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 3 expression: "crate::tests::parsing_expr_string(\"(a\")" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_1.snap index 14bc70a3b..285ab845e 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 4 expression: "crate::tests::parsing_expr_string(\"(a + 1\")" --- Node { @@ -13,7 +12,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_4.snap index 477b1e0af..371a9181f 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 35 expression: "crate::tests::parsing_expr_string(r#\"(a\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_5.snap index 3ad71240b..d93c9b71b 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__paren_recovery_5.snap @@ -12,7 +12,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_0.snap index 1b69ce416..5f6e442ad 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_0.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 119 expression: "crate::tests::parsing_expr_string(r#\"s {\"#)" --- Node { @@ -9,7 +8,14 @@ Node { name: Node { node: Identifier { names: [ - "s", + Node { + node: "s", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_1.snap index 9307c0f49..b592bbc4f 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 120 expression: "crate::tests::parsing_expr_string(r#\"s {a=1\"#)" --- Node { @@ -9,7 +8,14 @@ Node { name: Node { node: Identifier { names: [ - "s", + Node { + node: "s", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -33,7 +39,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_2.snap index 542ccc3d8..d601fb18f 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_2.snap @@ -1,14 +1,27 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 121 expression: "crate::tests::parsing_expr_string(r#\"s.0 {a=1}\"#)" --- Node { node: Identifier( Identifier { names: [ - "s", - "", + Node { + node: "s", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, + Node { + node: "", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_3.snap index 0193a494b..3e5dc5123 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 148 expression: "crate::tests::parsing_expr_string(r#\"s?.a {a=1}\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "s", + Node { + node: "s", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -25,7 +31,14 @@ Node { attr: Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_4.snap index 979504c2a..99c0c29b9 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 123 expression: "crate::tests::parsing_expr_string(r#\"s. {a=1}\"#)" --- Node { @@ -9,8 +8,22 @@ Node { name: Node { node: Identifier { names: [ - "s", - "", + Node { + node: "s", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, + Node { + node: "", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, @@ -34,7 +47,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 5, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_5.snap index fd4f97652..2907944f9 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 124 expression: "crate::tests::parsing_expr_string(r#\"s( {a=1}\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "s", + Node { + node: "s", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -34,7 +40,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 5, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_6.snap index b6eaa091b..04fe34bef 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 125 expression: "crate::tests::parsing_expr_string(r#\"s(] {a=1}\"#)" --- Node { @@ -9,7 +8,14 @@ Node { name: Node { node: Identifier { names: [ - "s", + Node { + node: "s", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -33,7 +39,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_14.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_14.snap index 28fe08c4a..5e9ca1059 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_14.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_14.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 202 expression: "crate::tests::parsing_module_string(r#\"schema A:\na??: int \"#)" --- Module { @@ -47,7 +46,14 @@ Module { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 2, + column: 0, + end_line: 2, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -76,7 +82,14 @@ Module { node: Identifier( Identifier { names: [ - "int", + Node { + node: "int", + filename: "", + line: 2, + column: 5, + end_line: 2, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_15.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_15.snap index dc51a66dc..494159f25 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_15.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_15.snap @@ -46,7 +46,14 @@ Module { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 2, + column: 0, + end_line: 2, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -110,7 +117,14 @@ Module { node: Identifier( Identifier { names: [ - "int", + Node { + node: "int", + filename: "", + line: 2, + column: 4, + end_line: 2, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_16.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_16.snap index 2e13a431d..5d13381cc 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_16.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_16.snap @@ -46,7 +46,14 @@ Module { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 2, + column: 0, + end_line: 2, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -145,7 +152,14 @@ Module { node: Identifier( Identifier { names: [ - "int", + Node { + node: "int", + filename: "", + line: 2, + column: 5, + end_line: 2, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_19.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_19.snap index 873ddc802..8539f333f 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_19.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_19.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 210 expression: "crate::tests::parsing_module_string(r#\"@deprecated\nschema A:\n a: \"#)" --- Module { @@ -76,7 +75,14 @@ Module { node: Identifier( Identifier { names: [ - "deprecated", + Node { + node: "deprecated", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_20.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_20.snap index 4b486b891..c5fa8df5d 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_20.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_20.snap @@ -75,7 +75,14 @@ Module { node: Identifier( Identifier { names: [ - "deprecated", + Node { + node: "deprecated", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_21.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_21.snap index 4b486b891..c5fa8df5d 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_21.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_21.snap @@ -75,7 +75,14 @@ Module { node: Identifier( Identifier { names: [ - "deprecated", + Node { + node: "deprecated", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_22.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_22.snap index 6fedcaa4a..72bbd739f 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_22.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_22.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 219 expression: "crate::tests::parsing_module_string(r#\"@deprecated(a\nschema A:\n a: \"#)" --- Module { @@ -76,7 +75,14 @@ Module { node: Identifier( Identifier { names: [ - "deprecated", + Node { + node: "deprecated", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, @@ -93,7 +99,14 @@ Module { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 12, + end_line: 1, + end_column: 13, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_23.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_23.snap index 39fdcfb21..1d4f989f6 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_23.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_23.snap @@ -75,7 +75,14 @@ Module { node: Identifier( Identifier { names: [ - "deprecated", + Node { + node: "deprecated", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, @@ -92,7 +99,14 @@ Module { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 12, + end_line: 1, + end_column: 13, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_24.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_24.snap index 2dfa47ba4..4a8a5d76c 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_24.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_24.snap @@ -75,7 +75,14 @@ Module { node: Identifier( Identifier { names: [ - "deprecated", + Node { + node: "deprecated", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_27.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_27.snap index 886cbd9f0..3d10e178c 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_27.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_27.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 248 expression: "crate::tests::parsing_module_string(r#\"\nschema A:\n [.str]: str \"#)" --- Module { @@ -48,7 +47,14 @@ Module { attr: Node { node: Identifier { names: [ - "str", + Node { + node: "str", + filename: "", + line: 3, + column: 6, + end_line: 3, + end_column: 9, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_28.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_28.snap index bc7a184ed..869a6005e 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_28.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_28.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 251 expression: "crate::tests::parsing_module_string(r#\"\nschema A:\n [....str]: str \"#)" --- Module { @@ -71,7 +70,14 @@ Module { attr: Node { node: Identifier { names: [ - "str", + Node { + node: "str", + filename: "", + line: 3, + column: 9, + end_line: 3, + end_column: 12, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_30.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_30.snap index 8d2d3c25d..df35ee568 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_30.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_30.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 257 expression: "crate::tests::parsing_module_string(r#\"\nschema A:\n .\"#)" --- Module { @@ -48,7 +47,14 @@ Module { attr: Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 3, + column: 5, + end_line: 3, + end_column: 5, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_4.snap index 1a1d19920..3a247ff45 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 185 expression: "crate::tests::parsing_module_string(r#\"schema A:B\"#)" --- Module { @@ -47,7 +46,14 @@ Module { node: Identifier( Identifier { names: [ - "B", + Node { + node: "B", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 10, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_5.snap index 9aba9f49b..3823900f2 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 186 expression: "crate::tests::parsing_module_string(r#\"schema A(:\"#)" --- Module { @@ -25,7 +24,14 @@ Module { Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 9, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_6.snap index a66f002e6..e1fe5bd2b 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 187 expression: "crate::tests::parsing_module_string(r#\"schema A():\"#)" --- Module { @@ -25,7 +24,14 @@ Module { Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 9, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_7.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_7.snap index 44cda624b..11b6b5300 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_7.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_7.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 188 expression: "crate::tests::parsing_module_string(r#\"schema A:\na:: int\"#)" --- Module { @@ -47,7 +46,14 @@ Module { node: Identifier( Identifier { names: [ - "int", + Node { + node: "int", + filename: "", + line: 2, + column: 4, + end_line: 2, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_8.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_8.snap index cb61c6ea5..0d6b1ff2e 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_8.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_8.snap @@ -45,7 +45,14 @@ Module { Node { node: Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 2, + column: 0, + end_line: 2, + end_column: 1, + }, ], pkgpath: "", ctx: Store, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_0.snap index cb4864d88..bbe003c51 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_0.snap @@ -1,14 +1,27 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 97 expression: "crate::tests::parsing_expr_string(r#\"a.\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", - "", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, + Node { + node: "", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_1.snap index 1f7b8919f..97847cd0c 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_1.snap @@ -1,15 +1,35 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 98 expression: "crate::tests::parsing_expr_string(r#\"a.b.\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", - "b", - "", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, + Node { + node: "b", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, + Node { + node: "", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_10.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_10.snap index cd8646e56..35c0b2f28 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_10.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_10.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 132 expression: "crate::tests::parsing_expr_string(r#\"a?.b?\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -25,7 +31,14 @@ Node { attr: Node { node: Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_11.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_11.snap index ab5eb759e..615b8a3db 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_11.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_11.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 133 expression: "crate::tests::parsing_expr_string(r#\"a?.b?.c?\"#)" --- Node { @@ -13,7 +12,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -28,7 +34,14 @@ Node { attr: Node { node: Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, @@ -52,7 +65,14 @@ Node { attr: Node { node: Identifier { names: [ - "c", + Node { + node: "c", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_12.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_12.snap index d7b1323d1..7deefffd2 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_12.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_12.snap @@ -1,14 +1,27 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 109 expression: "crate::tests::parsing_expr_string(r#\"a.0\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", - "", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, + Node { + node: "", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_13.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_13.snap index af9f4e8ca..0f7564c77 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_13.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_13.snap @@ -1,15 +1,35 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 110 expression: "crate::tests::parsing_expr_string(r#\"a..0\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", - "", - "", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, + Node { + node: "", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 2, + }, + Node { + node: "", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_14.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_14.snap index 9a5b4cf15..9a683650f 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_14.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_14.snap @@ -1,13 +1,19 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 111 expression: "crate::tests::parsing_expr_string(r#\"a...\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_2.snap index d11e41436..ad5c2dd8d 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_2.snap @@ -1,16 +1,43 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 99 expression: "crate::tests::parsing_expr_string(r#\"a.b.c.\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", - "b", - "c", - "", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, + Node { + node: "b", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, + Node { + node: "c", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 5, + }, + Node { + node: "", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_3.snap index 950ffee84..992848968 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 125 expression: "crate::tests::parsing_expr_string(r#\"''.\"#)" --- Node { @@ -23,7 +22,14 @@ Node { attr: Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_4.snap index 2dba80df1..45ff29d11 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 126 expression: "crate::tests::parsing_expr_string(r#\"''.lower\"#)" --- Node { @@ -23,7 +22,14 @@ Node { attr: Node { node: Identifier { names: [ - "lower", + Node { + node: "lower", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_5.snap index 66985055c..484388876 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 127 expression: "crate::tests::parsing_expr_string(r#\"''.lower().\"#)" --- Node { @@ -29,7 +28,14 @@ Node { attr: Node { node: Identifier { names: [ - "lower", + Node { + node: "lower", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, @@ -63,7 +69,14 @@ Node { attr: Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 11, + end_line: 1, + end_column: 11, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_6.snap index 92f80ac92..675b0e19b 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 128 expression: "crate::tests::parsing_expr_string(r#\"a?.\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -25,7 +31,14 @@ Node { attr: Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_7.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_7.snap index 8d2f9cf8b..20d302127 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_7.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_7.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 129 expression: "crate::tests::parsing_expr_string(r#\"a?.b?.\"#)" --- Node { @@ -13,7 +12,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -28,7 +34,14 @@ Node { attr: Node { node: Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, @@ -52,7 +65,14 @@ Node { attr: Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_8.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_8.snap index 0b72f3c28..202dd5709 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_8.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_8.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 130 expression: "crate::tests::parsing_expr_string(r#\"a?.b?.c?.\"#)" --- Node { @@ -16,7 +15,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -31,7 +37,14 @@ Node { attr: Node { node: Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, @@ -55,7 +68,14 @@ Node { attr: Node { node: Identifier { names: [ - "c", + Node { + node: "c", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, @@ -79,7 +99,14 @@ Node { attr: Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 9, + end_line: 1, + end_column: 9, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_9.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_9.snap index 195dc0927..25cc39e66 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_9.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__select_recovery_9.snap @@ -1,13 +1,19 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 106 expression: "crate::tests::parsing_expr_string(r#\"a?\"#)" --- Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_0.snap index d01279057..7acd7bdf8 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_0.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 109 expression: "crate::tests::parsing_expr_string(r#\"a[b 1]\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_1.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_1.snap index e70e97e1f..6877c8670 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_1.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_1.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 110 expression: "crate::tests::parsing_expr_string(r#\"a[1,b]\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_10.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_10.snap index 387493556..c0b5ac715 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_10.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_10.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 119 expression: "crate::tests::parsing_expr_string(r#\"[0]?.[0]\"#)" --- Node { @@ -41,7 +40,14 @@ Node { attr: Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 5, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_12.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_12.snap index c668bfa9f..d68841a4b 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_12.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_12.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 121 expression: "crate::tests::parsing_expr_string(r#\"[0].?[0]\"#)" --- Node { @@ -41,7 +40,14 @@ Node { attr: Node { node: Identifier { names: [ - "", + Node { + node: "", + filename: "", + line: 1, + column: 4, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_2.snap index 9c68da6f3..034165107 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_2.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 111 expression: "crate::tests::parsing_expr_string(r#\"a[b;;b]\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, @@ -27,7 +33,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_3.snap index 9c5a58260..6e6a2f491 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 112 expression: "crate::tests::parsing_expr_string(r#\"a[b[b]\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_4.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_4.snap index 413332403..53b3104ed 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_4.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_4.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 113 expression: "crate::tests::parsing_expr_string(r#\"a[:::]\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_5.snap index 7b1b9eb23..45d2cd7cc 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 114 expression: "crate::tests::parsing_expr_string(r#\"a[:1:2:]\"#)" --- Node { @@ -10,7 +9,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 0, + end_line: 1, + end_column: 1, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_6.snap index 6f6c74f97..b250a5626 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__subscript_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 115 expression: "crate::tests::parsing_expr_string(r#\"[][a:b:c:d]\"#)" --- Node { @@ -25,7 +24,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 3, + end_line: 1, + end_column: 4, + }, ], pkgpath: "", ctx: Load, @@ -43,7 +49,14 @@ Node { node: Identifier( Identifier { names: [ - "b", + Node { + node: "b", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 6, + }, ], pkgpath: "", ctx: Load, @@ -61,7 +74,14 @@ Node { node: Identifier( Identifier { names: [ - "c", + Node { + node: "c", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_2.snap index bbc096f88..0ecf3bdfe 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_2.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 169 expression: "crate::tests::parsing_module_string(r#\"type pkg_path.\"#)" --- Module { @@ -15,8 +14,22 @@ Module { type_name: Node { node: Identifier { names: [ - "pkg_path", - "", + Node { + node: "pkg_path", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 13, + }, + Node { + node: "", + filename: "", + line: 1, + column: 14, + end_line: 1, + end_column: 14, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_5.snap index 4af33f775..c72070ca9 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_5.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 172 expression: "crate::tests::parsing_module_string(r#\"type pkg_path = \"#)" --- Module { @@ -15,7 +14,14 @@ Module { type_name: Node { node: Identifier { names: [ - "pkg_path", + Node { + node: "pkg_path", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 13, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_6.snap index 1e93cb421..1448272f1 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__type_alias_recovery_6.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 173 expression: "crate::tests::parsing_module_string(r#\"type pkg_path = 'data'\"#)" --- Module { @@ -15,7 +14,14 @@ Module { type_name: Node { node: Identifier { names: [ - "pkg_path", + Node { + node: "pkg_path", + filename: "", + line: 1, + column: 5, + end_line: 1, + end_column: 13, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_0.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_0.snap index 144ed743f..82b3cdaa4 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_0.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_0.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 55 expression: "crate::tests::parsing_expr_string(r#\"!a\"#)" --- Node { @@ -11,7 +10,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 1, + end_line: 1, + end_column: 2, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_2.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_2.snap index 5e246c367..dbe5ca25a 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_2.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_2.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 57 expression: "crate::tests::parsing_expr_string(r#\"not (!a)\"#)" --- Node { @@ -18,7 +17,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 6, + end_line: 1, + end_column: 7, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_3.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_3.snap index 8121da9b4..c564377bc 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_3.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_3.snap @@ -1,6 +1,5 @@ --- source: parser/src/tests/error_recovery.rs -assertion_line: 58 expression: "crate::tests::parsing_expr_string(r#\"! (not a)\"#)" --- Node { @@ -18,7 +17,14 @@ Node { node: Identifier( Identifier { names: [ - "a", + Node { + node: "a", + filename: "", + line: 1, + column: 7, + end_line: 1, + end_column: 8, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_5.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_5.snap index b18119d8e..99c80e731 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_5.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_5.snap @@ -34,7 +34,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_6.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_6.snap index 7685fb8e4..3f045df32 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_6.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_6.snap @@ -34,7 +34,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_7.snap b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_7.snap index 6eb7e2113..c909a3f43 100644 --- a/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_7.snap +++ b/kclvm/parser/src/tests/snapshots/kclvm_parser__tests__error_recovery__unary_recovery_7.snap @@ -34,7 +34,14 @@ Node { node: Identifier( Identifier { names: [ - "i", + Node { + node: "i", + filename: "", + line: 1, + column: 2, + end_line: 1, + end_column: 3, + }, ], pkgpath: "", ctx: Load, diff --git a/kclvm/parser/testdata/assert-02.k.json b/kclvm/parser/testdata/assert-02.k.json index ff5701f2c..bda706403 100644 --- a/kclvm/parser/testdata/assert-02.k.json +++ b/kclvm/parser/testdata/assert-02.k.json @@ -1 +1 @@ -{"filename":"assert-02.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-02.k","line":1,"column":7,"end_line":1,"end_column":11},"if_cond":null,"msg":null}},"filename":"assert-02.k","line":1,"column":0,"end_line":1,"end_column":11},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-02.k","line":2,"column":7,"end_line":2,"end_column":8},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-02.k","line":2,"column":12,"end_line":2,"end_column":13}]}},"filename":"assert-02.k","line":2,"column":7,"end_line":2,"end_column":13},"if_cond":null,"msg":null}},"filename":"assert-02.k","line":2,"column":0,"end_line":2,"end_column":13},{"node":{"Assign":{"targets":[{"node":{"names":["_x"],"pkgpath":"","ctx":"Store"},"filename":"assert-02.k","line":3,"column":0,"end_line":3,"end_column":2}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-02.k","line":3,"column":5,"end_line":3,"end_column":16},"type_annotation":null,"ty":null}},"filename":"assert-02.k","line":3,"column":0,"end_line":3,"end_column":16},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["_x"],"pkgpath":"","ctx":"Load"}},"filename":"assert-02.k","line":4,"column":7,"end_line":4,"end_column":9},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-02.k","line":4,"column":13,"end_line":4,"end_column":24}]}},"filename":"assert-02.k","line":4,"column":7,"end_line":4,"end_column":24},"if_cond":null,"msg":null}},"filename":"assert-02.k","line":4,"column":0,"end_line":4,"end_column":24}],"comments":[]} +{"filename":"assert-02.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-02.k","line":1,"column":7,"end_line":1,"end_column":11},"if_cond":null,"msg":null}},"filename":"assert-02.k","line":1,"column":0,"end_line":1,"end_column":11},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-02.k","line":2,"column":7,"end_line":2,"end_column":8},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-02.k","line":2,"column":12,"end_line":2,"end_column":13}]}},"filename":"assert-02.k","line":2,"column":7,"end_line":2,"end_column":13},"if_cond":null,"msg":null}},"filename":"assert-02.k","line":2,"column":0,"end_line":2,"end_column":13},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_x","filename":"assert-02.k","line":3,"column":0,"end_line":3,"end_column":2}],"pkgpath":"","ctx":"Store"},"filename":"assert-02.k","line":3,"column":0,"end_line":3,"end_column":2}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-02.k","line":3,"column":5,"end_line":3,"end_column":16},"type_annotation":null,"ty":null}},"filename":"assert-02.k","line":3,"column":0,"end_line":3,"end_column":16},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"_x","filename":"assert-02.k","line":4,"column":7,"end_line":4,"end_column":9}],"pkgpath":"","ctx":"Load"}},"filename":"assert-02.k","line":4,"column":7,"end_line":4,"end_column":9},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-02.k","line":4,"column":13,"end_line":4,"end_column":24}]}},"filename":"assert-02.k","line":4,"column":7,"end_line":4,"end_column":24},"if_cond":null,"msg":null}},"filename":"assert-02.k","line":4,"column":0,"end_line":4,"end_column":24}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/assert-03.k.json b/kclvm/parser/testdata/assert-03.k.json index c002fb290..2b0813456 100644 --- a/kclvm/parser/testdata/assert-03.k.json +++ b/kclvm/parser/testdata/assert-03.k.json @@ -1 +1 @@ -{"filename":"assert-03.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"If":{"body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-03.k","line":2,"column":11,"end_line":2,"end_column":15},"if_cond":null,"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"Error messgae\"","value":"Error messgae"}},"filename":"assert-03.k","line":2,"column":17,"end_line":2,"end_column":32}}},"filename":"assert-03.k","line":2,"column":4,"end_line":2,"end_column":32},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-03.k","line":3,"column":11,"end_line":3,"end_column":12},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-03.k","line":3,"column":16,"end_line":3,"end_column":17}]}},"filename":"assert-03.k","line":3,"column":11,"end_line":3,"end_column":17},"if_cond":null,"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"\"","value":""}},"filename":"assert-03.k","line":3,"column":19,"end_line":3,"end_column":21}}},"filename":"assert-03.k","line":3,"column":4,"end_line":3,"end_column":21},{"node":{"Assign":{"targets":[{"node":{"names":["_x"],"pkgpath":"","ctx":"Store"},"filename":"assert-03.k","line":4,"column":4,"end_line":4,"end_column":6}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-03.k","line":4,"column":9,"end_line":4,"end_column":20},"type_annotation":null,"ty":null}},"filename":"assert-03.k","line":4,"column":4,"end_line":4,"end_column":20},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["_x"],"pkgpath":"","ctx":"Load"}},"filename":"assert-03.k","line":5,"column":11,"end_line":5,"end_column":13},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-03.k","line":5,"column":17,"end_line":5,"end_column":28}]}},"filename":"assert-03.k","line":5,"column":11,"end_line":5,"end_column":28},"if_cond":null,"msg":null}},"filename":"assert-03.k","line":5,"column":4,"end_line":5,"end_column":28}],"cond":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-03.k","line":1,"column":3,"end_line":1,"end_column":7},"orelse":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-03.k","line":7,"column":11,"end_line":7,"end_column":16},"if_cond":null,"msg":null}},"filename":"assert-03.k","line":7,"column":4,"end_line":7,"end_column":16}]}},"filename":"assert-03.k","line":1,"column":0,"end_line":8,"end_column":1}],"comments":[]} +{"filename":"assert-03.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"If":{"body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-03.k","line":2,"column":11,"end_line":2,"end_column":15},"if_cond":null,"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"Error messgae\"","value":"Error messgae"}},"filename":"assert-03.k","line":2,"column":17,"end_line":2,"end_column":32}}},"filename":"assert-03.k","line":2,"column":4,"end_line":2,"end_column":32},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-03.k","line":3,"column":11,"end_line":3,"end_column":12},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-03.k","line":3,"column":16,"end_line":3,"end_column":17}]}},"filename":"assert-03.k","line":3,"column":11,"end_line":3,"end_column":17},"if_cond":null,"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"\"","value":""}},"filename":"assert-03.k","line":3,"column":19,"end_line":3,"end_column":21}}},"filename":"assert-03.k","line":3,"column":4,"end_line":3,"end_column":21},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_x","filename":"assert-03.k","line":4,"column":4,"end_line":4,"end_column":6}],"pkgpath":"","ctx":"Store"},"filename":"assert-03.k","line":4,"column":4,"end_line":4,"end_column":6}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-03.k","line":4,"column":9,"end_line":4,"end_column":20},"type_annotation":null,"ty":null}},"filename":"assert-03.k","line":4,"column":4,"end_line":4,"end_column":20},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"_x","filename":"assert-03.k","line":5,"column":11,"end_line":5,"end_column":13}],"pkgpath":"","ctx":"Load"}},"filename":"assert-03.k","line":5,"column":11,"end_line":5,"end_column":13},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-03.k","line":5,"column":17,"end_line":5,"end_column":28}]}},"filename":"assert-03.k","line":5,"column":11,"end_line":5,"end_column":28},"if_cond":null,"msg":null}},"filename":"assert-03.k","line":5,"column":4,"end_line":5,"end_column":28}],"cond":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-03.k","line":1,"column":3,"end_line":1,"end_column":7},"orelse":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-03.k","line":7,"column":11,"end_line":7,"end_column":16},"if_cond":null,"msg":null}},"filename":"assert-03.k","line":7,"column":4,"end_line":7,"end_column":16}]}},"filename":"assert-03.k","line":1,"column":0,"end_line":8,"end_column":1}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/assert-if-0.k.json b/kclvm/parser/testdata/assert-if-0.k.json index a8ce96f5a..30ab48aa0 100644 --- a/kclvm/parser/testdata/assert-if-0.k.json +++ b/kclvm/parser/testdata/assert-if-0.k.json @@ -1 +1 @@ -{"filename":"assert-if-0.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-if-0.k","line":1,"column":7,"end_line":1,"end_column":11},"if_cond":null,"msg":null}},"filename":"assert-if-0.k","line":1,"column":0,"end_line":1,"end_column":11},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-0.k","line":2,"column":7,"end_line":2,"end_column":8},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-0.k","line":2,"column":12,"end_line":2,"end_column":13}]}},"filename":"assert-if-0.k","line":2,"column":7,"end_line":2,"end_column":13},"if_cond":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-if-0.k","line":2,"column":17,"end_line":2,"end_column":21},"msg":null}},"filename":"assert-if-0.k","line":2,"column":0,"end_line":2,"end_column":21},{"node":{"Assign":{"targets":[{"node":{"names":["_x"],"pkgpath":"","ctx":"Store"},"filename":"assert-if-0.k","line":3,"column":0,"end_line":3,"end_column":2}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-0.k","line":3,"column":5,"end_line":3,"end_column":16},"type_annotation":null,"ty":null}},"filename":"assert-if-0.k","line":3,"column":0,"end_line":3,"end_column":16},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["_x"],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-0.k","line":4,"column":7,"end_line":4,"end_column":9},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-0.k","line":4,"column":13,"end_line":4,"end_column":24}]}},"filename":"assert-if-0.k","line":4,"column":7,"end_line":4,"end_column":24},"if_cond":{"node":{"Identifier":{"names":["_x"],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-0.k","line":4,"column":28,"end_line":4,"end_column":30},"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"_x need to be 'good case'\"","value":"_x need to be 'good case'"}},"filename":"assert-if-0.k","line":4,"column":32,"end_line":4,"end_column":59}}},"filename":"assert-if-0.k","line":4,"column":0,"end_line":4,"end_column":59}],"comments":[]} +{"filename":"assert-if-0.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-if-0.k","line":1,"column":7,"end_line":1,"end_column":11},"if_cond":null,"msg":null}},"filename":"assert-if-0.k","line":1,"column":0,"end_line":1,"end_column":11},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-0.k","line":2,"column":7,"end_line":2,"end_column":8},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-0.k","line":2,"column":12,"end_line":2,"end_column":13}]}},"filename":"assert-if-0.k","line":2,"column":7,"end_line":2,"end_column":13},"if_cond":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-if-0.k","line":2,"column":17,"end_line":2,"end_column":21},"msg":null}},"filename":"assert-if-0.k","line":2,"column":0,"end_line":2,"end_column":21},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_x","filename":"assert-if-0.k","line":3,"column":0,"end_line":3,"end_column":2}],"pkgpath":"","ctx":"Store"},"filename":"assert-if-0.k","line":3,"column":0,"end_line":3,"end_column":2}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-0.k","line":3,"column":5,"end_line":3,"end_column":16},"type_annotation":null,"ty":null}},"filename":"assert-if-0.k","line":3,"column":0,"end_line":3,"end_column":16},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"_x","filename":"assert-if-0.k","line":4,"column":7,"end_line":4,"end_column":9}],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-0.k","line":4,"column":7,"end_line":4,"end_column":9},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-0.k","line":4,"column":13,"end_line":4,"end_column":24}]}},"filename":"assert-if-0.k","line":4,"column":7,"end_line":4,"end_column":24},"if_cond":{"node":{"Identifier":{"names":[{"node":"_x","filename":"assert-if-0.k","line":4,"column":28,"end_line":4,"end_column":30}],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-0.k","line":4,"column":28,"end_line":4,"end_column":30},"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"_x need to be 'good case'\"","value":"_x need to be 'good case'"}},"filename":"assert-if-0.k","line":4,"column":32,"end_line":4,"end_column":59}}},"filename":"assert-if-0.k","line":4,"column":0,"end_line":4,"end_column":59}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/assert-if-1.k.json b/kclvm/parser/testdata/assert-if-1.k.json index 86f28932d..bed7e15dd 100644 --- a/kclvm/parser/testdata/assert-if-1.k.json +++ b/kclvm/parser/testdata/assert-if-1.k.json @@ -1 +1 @@ -{"filename":"assert-if-1.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-if-1.k","line":1,"column":7,"end_line":1,"end_column":11},"if_cond":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-if-1.k","line":1,"column":15,"end_line":1,"end_column":20},"msg":null}},"filename":"assert-if-1.k","line":1,"column":0,"end_line":1,"end_column":20},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-1.k","line":2,"column":7,"end_line":2,"end_column":8},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-1.k","line":2,"column":12,"end_line":2,"end_column":13}]}},"filename":"assert-if-1.k","line":2,"column":7,"end_line":2,"end_column":13},"if_cond":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-if-1.k","line":2,"column":17,"end_line":2,"end_column":22},"msg":null}},"filename":"assert-if-1.k","line":2,"column":0,"end_line":2,"end_column":22},{"node":{"Assign":{"targets":[{"node":{"names":["_x"],"pkgpath":"","ctx":"Store"},"filename":"assert-if-1.k","line":3,"column":0,"end_line":3,"end_column":2}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-1.k","line":3,"column":5,"end_line":3,"end_column":16},"type_annotation":null,"ty":null}},"filename":"assert-if-1.k","line":3,"column":0,"end_line":3,"end_column":16},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["_x"],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-1.k","line":4,"column":7,"end_line":4,"end_column":9},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-1.k","line":4,"column":13,"end_line":4,"end_column":24}]}},"filename":"assert-if-1.k","line":4,"column":7,"end_line":4,"end_column":24},"if_cond":{"node":{"Unary":{"op":"Not","operand":{"node":{"Identifier":{"names":["_x"],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-1.k","line":4,"column":32,"end_line":4,"end_column":34}}},"filename":"assert-if-1.k","line":4,"column":28,"end_line":4,"end_column":34},"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"_x need to be 'good case'\"","value":"_x need to be 'good case'"}},"filename":"assert-if-1.k","line":4,"column":36,"end_line":4,"end_column":63}}},"filename":"assert-if-1.k","line":4,"column":0,"end_line":4,"end_column":63}],"comments":[]} +{"filename":"assert-if-1.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-if-1.k","line":1,"column":7,"end_line":1,"end_column":11},"if_cond":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-if-1.k","line":1,"column":15,"end_line":1,"end_column":20},"msg":null}},"filename":"assert-if-1.k","line":1,"column":0,"end_line":1,"end_column":20},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-1.k","line":2,"column":7,"end_line":2,"end_column":8},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-1.k","line":2,"column":12,"end_line":2,"end_column":13}]}},"filename":"assert-if-1.k","line":2,"column":7,"end_line":2,"end_column":13},"if_cond":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-if-1.k","line":2,"column":17,"end_line":2,"end_column":22},"msg":null}},"filename":"assert-if-1.k","line":2,"column":0,"end_line":2,"end_column":22},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_x","filename":"assert-if-1.k","line":3,"column":0,"end_line":3,"end_column":2}],"pkgpath":"","ctx":"Store"},"filename":"assert-if-1.k","line":3,"column":0,"end_line":3,"end_column":2}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-1.k","line":3,"column":5,"end_line":3,"end_column":16},"type_annotation":null,"ty":null}},"filename":"assert-if-1.k","line":3,"column":0,"end_line":3,"end_column":16},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"_x","filename":"assert-if-1.k","line":4,"column":7,"end_line":4,"end_column":9}],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-1.k","line":4,"column":7,"end_line":4,"end_column":9},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-1.k","line":4,"column":13,"end_line":4,"end_column":24}]}},"filename":"assert-if-1.k","line":4,"column":7,"end_line":4,"end_column":24},"if_cond":{"node":{"Unary":{"op":"Not","operand":{"node":{"Identifier":{"names":[{"node":"_x","filename":"assert-if-1.k","line":4,"column":32,"end_line":4,"end_column":34}],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-1.k","line":4,"column":32,"end_line":4,"end_column":34}}},"filename":"assert-if-1.k","line":4,"column":28,"end_line":4,"end_column":34},"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"_x need to be 'good case'\"","value":"_x need to be 'good case'"}},"filename":"assert-if-1.k","line":4,"column":36,"end_line":4,"end_column":63}}},"filename":"assert-if-1.k","line":4,"column":0,"end_line":4,"end_column":63}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/assert-if-2.k.json b/kclvm/parser/testdata/assert-if-2.k.json index 483a60eb7..9882da148 100644 --- a/kclvm/parser/testdata/assert-if-2.k.json +++ b/kclvm/parser/testdata/assert-if-2.k.json @@ -1 +1 @@ -{"filename":"assert-if-2.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Schema":{"doc":"","name":{"node":"Data","filename":"assert-if-2.k","line":1,"column":7,"end_line":1,"end_column":11},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-if-2.k","line":2,"column":11,"end_line":2,"end_column":15},"if_cond":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-if-2.k","line":2,"column":19,"end_line":2,"end_column":24},"msg":null}},"filename":"assert-if-2.k","line":2,"column":4,"end_line":2,"end_column":24},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-2.k","line":3,"column":11,"end_line":3,"end_column":12},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-2.k","line":3,"column":16,"end_line":3,"end_column":17}]}},"filename":"assert-if-2.k","line":3,"column":11,"end_line":3,"end_column":17},"if_cond":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-if-2.k","line":3,"column":21,"end_line":3,"end_column":26},"msg":null}},"filename":"assert-if-2.k","line":3,"column":4,"end_line":3,"end_column":26},{"node":{"Assign":{"targets":[{"node":{"names":["_x"],"pkgpath":"","ctx":"Store"},"filename":"assert-if-2.k","line":4,"column":4,"end_line":4,"end_column":6}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-2.k","line":4,"column":9,"end_line":4,"end_column":20},"type_annotation":null,"ty":null}},"filename":"assert-if-2.k","line":4,"column":4,"end_line":4,"end_column":20},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":["_x"],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-2.k","line":5,"column":11,"end_line":5,"end_column":13},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-2.k","line":5,"column":17,"end_line":5,"end_column":28}]}},"filename":"assert-if-2.k","line":5,"column":11,"end_line":5,"end_column":28},"if_cond":{"node":{"Unary":{"op":"Not","operand":{"node":{"Identifier":{"names":["_x"],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-2.k","line":5,"column":36,"end_line":5,"end_column":38}}},"filename":"assert-if-2.k","line":5,"column":32,"end_line":5,"end_column":38},"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"_x need to be 'good case'\"","value":"_x need to be 'good case'"}},"filename":"assert-if-2.k","line":5,"column":40,"end_line":5,"end_column":67}}},"filename":"assert-if-2.k","line":5,"column":4,"end_line":5,"end_column":67}],"decorators":[],"checks":[],"index_signature":null}},"filename":"assert-if-2.k","line":1,"column":0,"end_line":7,"end_column":0},{"node":{"Assign":{"targets":[{"node":{"names":["data"],"pkgpath":"","ctx":"Store"},"filename":"assert-if-2.k","line":7,"column":0,"end_line":7,"end_column":4}],"value":{"node":{"Schema":{"name":{"node":{"names":["Data"],"pkgpath":"","ctx":"Load"},"filename":"assert-if-2.k","line":7,"column":7,"end_line":7,"end_column":11},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[]}},"filename":"assert-if-2.k","line":7,"column":12,"end_line":7,"end_column":14}}},"filename":"assert-if-2.k","line":7,"column":7,"end_line":7,"end_column":14},"type_annotation":null,"ty":null}},"filename":"assert-if-2.k","line":7,"column":0,"end_line":7,"end_column":14}],"comments":[]} +{"filename":"assert-if-2.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Schema":{"doc":"","name":{"node":"Data","filename":"assert-if-2.k","line":1,"column":7,"end_line":1,"end_column":11},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"Assert":{"test":{"node":{"NameConstantLit":{"value":"True"}},"filename":"assert-if-2.k","line":2,"column":11,"end_line":2,"end_column":15},"if_cond":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-if-2.k","line":2,"column":19,"end_line":2,"end_column":24},"msg":null}},"filename":"assert-if-2.k","line":2,"column":4,"end_line":2,"end_column":24},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-2.k","line":3,"column":11,"end_line":3,"end_column":12},"ops":["Eq"],"comparators":[{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assert-if-2.k","line":3,"column":16,"end_line":3,"end_column":17}]}},"filename":"assert-if-2.k","line":3,"column":11,"end_line":3,"end_column":17},"if_cond":{"node":{"NameConstantLit":{"value":"False"}},"filename":"assert-if-2.k","line":3,"column":21,"end_line":3,"end_column":26},"msg":null}},"filename":"assert-if-2.k","line":3,"column":4,"end_line":3,"end_column":26},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_x","filename":"assert-if-2.k","line":4,"column":4,"end_line":4,"end_column":6}],"pkgpath":"","ctx":"Store"},"filename":"assert-if-2.k","line":4,"column":4,"end_line":4,"end_column":6}],"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-2.k","line":4,"column":9,"end_line":4,"end_column":20},"type_annotation":null,"ty":null}},"filename":"assert-if-2.k","line":4,"column":4,"end_line":4,"end_column":20},{"node":{"Assert":{"test":{"node":{"Compare":{"left":{"node":{"Identifier":{"names":[{"node":"_x","filename":"assert-if-2.k","line":5,"column":11,"end_line":5,"end_column":13}],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-2.k","line":5,"column":11,"end_line":5,"end_column":13},"ops":["Eq"],"comparators":[{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"good case\"","value":"good case"}},"filename":"assert-if-2.k","line":5,"column":17,"end_line":5,"end_column":28}]}},"filename":"assert-if-2.k","line":5,"column":11,"end_line":5,"end_column":28},"if_cond":{"node":{"Unary":{"op":"Not","operand":{"node":{"Identifier":{"names":[{"node":"_x","filename":"assert-if-2.k","line":5,"column":36,"end_line":5,"end_column":38}],"pkgpath":"","ctx":"Load"}},"filename":"assert-if-2.k","line":5,"column":36,"end_line":5,"end_column":38}}},"filename":"assert-if-2.k","line":5,"column":32,"end_line":5,"end_column":38},"msg":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"_x need to be 'good case'\"","value":"_x need to be 'good case'"}},"filename":"assert-if-2.k","line":5,"column":40,"end_line":5,"end_column":67}}},"filename":"assert-if-2.k","line":5,"column":4,"end_line":5,"end_column":67}],"decorators":[],"checks":[],"index_signature":null}},"filename":"assert-if-2.k","line":1,"column":0,"end_line":7,"end_column":0},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"data","filename":"assert-if-2.k","line":7,"column":0,"end_line":7,"end_column":4}],"pkgpath":"","ctx":"Store"},"filename":"assert-if-2.k","line":7,"column":0,"end_line":7,"end_column":4}],"value":{"node":{"Schema":{"name":{"node":{"names":[{"node":"Data","filename":"assert-if-2.k","line":7,"column":7,"end_line":7,"end_column":11}],"pkgpath":"","ctx":"Load"},"filename":"assert-if-2.k","line":7,"column":7,"end_line":7,"end_column":11},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[]}},"filename":"assert-if-2.k","line":7,"column":12,"end_line":7,"end_column":14}}},"filename":"assert-if-2.k","line":7,"column":7,"end_line":7,"end_column":14},"type_annotation":null,"ty":null}},"filename":"assert-if-2.k","line":7,"column":0,"end_line":7,"end_column":14}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/assign-01.k.json b/kclvm/parser/testdata/assign-01.k.json index a02084218..8f6def8f8 100644 --- a/kclvm/parser/testdata/assign-01.k.json +++ b/kclvm/parser/testdata/assign-01.k.json @@ -1 +1 @@ -{"filename":"assign-01.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Store"},"filename":"assign-01.k","line":1,"column":0,"end_line":1,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assign-01.k","line":1,"column":2,"end_line":1,"end_column":3},"type_annotation":null,"ty":null}},"filename":"assign-01.k","line":1,"column":0,"end_line":1,"end_column":3},{"node":{"Assign":{"targets":[{"node":{"names":["b"],"pkgpath":"","ctx":"Store"},"filename":"assign-01.k","line":2,"column":0,"end_line":2,"end_column":1}],"value":{"node":{"Binary":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assign-01.k","line":2,"column":4,"end_line":2,"end_column":5},"op":{"Bin":"Add"},"right":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"assign-01.k","line":2,"column":8,"end_line":2,"end_column":9}}},"filename":"assign-01.k","line":2,"column":4,"end_line":2,"end_column":9},"type_annotation":null,"ty":null}},"filename":"assign-01.k","line":2,"column":0,"end_line":2,"end_column":9},{"node":{"Assign":{"targets":[{"node":{"names":["c"],"pkgpath":"","ctx":"Store"},"filename":"assign-01.k","line":3,"column":0,"end_line":3,"end_column":1}],"value":{"node":{"Binary":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"assign-01.k","line":3,"column":4,"end_line":3,"end_column":5},"op":{"Bin":"Add"},"right":{"node":{"Binary":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"assign-01.k","line":3,"column":8,"end_line":3,"end_column":9},"op":{"Bin":"Mul"},"right":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"assign-01.k","line":3,"column":10,"end_line":3,"end_column":11}}},"filename":"assign-01.k","line":3,"column":8,"end_line":3,"end_column":11}}},"filename":"assign-01.k","line":3,"column":4,"end_line":3,"end_column":11},"type_annotation":null,"ty":null}},"filename":"assign-01.k","line":3,"column":0,"end_line":3,"end_column":11}],"comments":[]} +{"filename":"assign-01.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"a","filename":"assign-01.k","line":1,"column":0,"end_line":1,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"assign-01.k","line":1,"column":0,"end_line":1,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assign-01.k","line":1,"column":2,"end_line":1,"end_column":3},"type_annotation":null,"ty":null}},"filename":"assign-01.k","line":1,"column":0,"end_line":1,"end_column":3},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"b","filename":"assign-01.k","line":2,"column":0,"end_line":2,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"assign-01.k","line":2,"column":0,"end_line":2,"end_column":1}],"value":{"node":{"Binary":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"assign-01.k","line":2,"column":4,"end_line":2,"end_column":5},"op":{"Bin":"Add"},"right":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"assign-01.k","line":2,"column":8,"end_line":2,"end_column":9}}},"filename":"assign-01.k","line":2,"column":4,"end_line":2,"end_column":9},"type_annotation":null,"ty":null}},"filename":"assign-01.k","line":2,"column":0,"end_line":2,"end_column":9},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"c","filename":"assign-01.k","line":3,"column":0,"end_line":3,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"assign-01.k","line":3,"column":0,"end_line":3,"end_column":1}],"value":{"node":{"Binary":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"assign-01.k","line":3,"column":4,"end_line":3,"end_column":5},"op":{"Bin":"Add"},"right":{"node":{"Binary":{"left":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"assign-01.k","line":3,"column":8,"end_line":3,"end_column":9},"op":{"Bin":"Mul"},"right":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"assign-01.k","line":3,"column":10,"end_line":3,"end_column":11}}},"filename":"assign-01.k","line":3,"column":8,"end_line":3,"end_column":11}}},"filename":"assign-01.k","line":3,"column":4,"end_line":3,"end_column":11},"type_annotation":null,"ty":null}},"filename":"assign-01.k","line":3,"column":0,"end_line":3,"end_column":11}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/config_expr-01.k.json b/kclvm/parser/testdata/config_expr-01.k.json index 9c8490bd9..2cf0a652e 100644 --- a/kclvm/parser/testdata/config_expr-01.k.json +++ b/kclvm/parser/testdata/config_expr-01.k.json @@ -1 +1 @@ -{"filename":"config_expr-01.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["config"],"pkgpath":"","ctx":"Store"},"filename":"config_expr-01.k","line":1,"column":0,"end_line":1,"end_column":6}],"value":{"node":{"Config":{"items":[]}},"filename":"config_expr-01.k","line":1,"column":9,"end_line":2,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-01.k","line":1,"column":0,"end_line":2,"end_column":1}],"comments":[]} +{"filename":"config_expr-01.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"config","filename":"config_expr-01.k","line":1,"column":0,"end_line":1,"end_column":6}],"pkgpath":"","ctx":"Store"},"filename":"config_expr-01.k","line":1,"column":0,"end_line":1,"end_column":6}],"value":{"node":{"Config":{"items":[]}},"filename":"config_expr-01.k","line":1,"column":9,"end_line":2,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-01.k","line":1,"column":0,"end_line":2,"end_column":1}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/config_expr-02.k.json b/kclvm/parser/testdata/config_expr-02.k.json index 401df00b1..a279c7914 100644 --- a/kclvm/parser/testdata/config_expr-02.k.json +++ b/kclvm/parser/testdata/config_expr-02.k.json @@ -1 +1 @@ -{"filename":"config_expr-02.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["config"],"pkgpath":"","ctx":"Store"},"filename":"config_expr-02.k","line":1,"column":0,"end_line":1,"end_column":6}],"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["k1"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-02.k","line":2,"column":4,"end_line":2,"end_column":6},"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":111}}},"filename":"config_expr-02.k","line":2,"column":9,"end_line":2,"end_column":12},"operation":"Override","insert_index":-1},"filename":"config_expr-02.k","line":2,"column":4,"end_line":2,"end_column":12},{"node":{"key":{"node":{"Identifier":{"names":["k2"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-02.k","line":3,"column":4,"end_line":3,"end_column":6},"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":222}}},"filename":"config_expr-02.k","line":3,"column":9,"end_line":3,"end_column":12},"operation":"Override","insert_index":-1},"filename":"config_expr-02.k","line":3,"column":4,"end_line":3,"end_column":12}]}},"filename":"config_expr-02.k","line":1,"column":9,"end_line":4,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-02.k","line":1,"column":0,"end_line":4,"end_column":1}],"comments":[]} +{"filename":"config_expr-02.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"config","filename":"config_expr-02.k","line":1,"column":0,"end_line":1,"end_column":6}],"pkgpath":"","ctx":"Store"},"filename":"config_expr-02.k","line":1,"column":0,"end_line":1,"end_column":6}],"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"k1","filename":"config_expr-02.k","line":2,"column":4,"end_line":2,"end_column":6}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-02.k","line":2,"column":4,"end_line":2,"end_column":6},"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":111}}},"filename":"config_expr-02.k","line":2,"column":9,"end_line":2,"end_column":12},"operation":"Override","insert_index":-1},"filename":"config_expr-02.k","line":2,"column":4,"end_line":2,"end_column":12},{"node":{"key":{"node":{"Identifier":{"names":[{"node":"k2","filename":"config_expr-02.k","line":3,"column":4,"end_line":3,"end_column":6}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-02.k","line":3,"column":4,"end_line":3,"end_column":6},"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":222}}},"filename":"config_expr-02.k","line":3,"column":9,"end_line":3,"end_column":12},"operation":"Override","insert_index":-1},"filename":"config_expr-02.k","line":3,"column":4,"end_line":3,"end_column":12}]}},"filename":"config_expr-02.k","line":1,"column":9,"end_line":4,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-02.k","line":1,"column":0,"end_line":4,"end_column":1}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/config_expr-03.k.json b/kclvm/parser/testdata/config_expr-03.k.json index 7007da898..ea175b7ad 100644 --- a/kclvm/parser/testdata/config_expr-03.k.json +++ b/kclvm/parser/testdata/config_expr-03.k.json @@ -1 +1 @@ -{"filename":"config_expr-03.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["config"],"pkgpath":"","ctx":"Store"},"filename":"config_expr-03.k","line":3,"column":0,"end_line":3,"end_column":6}],"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["main"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":4,"column":4,"end_line":4,"end_column":8},"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["env"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":5,"column":8,"end_line":5,"end_column":11},"value":{"node":{"List":{"elts":[{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["name"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":6,"column":13,"end_line":6,"end_column":17},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"ENV_1\"","value":"ENV_1"}},"filename":"config_expr-03.k","line":6,"column":19,"end_line":6,"end_column":26},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":6,"column":13,"end_line":6,"end_column":26},{"node":{"key":{"node":{"Identifier":{"names":["value"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":6,"column":28,"end_line":6,"end_column":33},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"1\"","value":"1"}},"filename":"config_expr-03.k","line":6,"column":35,"end_line":6,"end_column":38},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":6,"column":28,"end_line":6,"end_column":38}]}},"filename":"config_expr-03.k","line":6,"column":12,"end_line":6,"end_column":39}],"ctx":"Load"}},"filename":"config_expr-03.k","line":5,"column":13,"end_line":7,"end_column":9},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":5,"column":8,"end_line":7,"end_column":9}]}},"filename":"config_expr-03.k","line":4,"column":10,"end_line":8,"end_column":5},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":4,"column":4,"end_line":8,"end_column":5},{"node":{"key":{"node":{"Identifier":{"names":["main"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":9,"column":4,"end_line":9,"end_column":8},"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["env"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":10,"column":8,"end_line":10,"end_column":11},"value":{"node":{"List":{"elts":[{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["name"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":11,"column":13,"end_line":11,"end_column":17},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"ENV_2\"","value":"ENV_2"}},"filename":"config_expr-03.k","line":11,"column":19,"end_line":11,"end_column":26},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":11,"column":13,"end_line":11,"end_column":26},{"node":{"key":{"node":{"Identifier":{"names":["value"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":11,"column":28,"end_line":11,"end_column":33},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"2\"","value":"2"}},"filename":"config_expr-03.k","line":11,"column":35,"end_line":11,"end_column":38},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":11,"column":28,"end_line":11,"end_column":38}]}},"filename":"config_expr-03.k","line":11,"column":12,"end_line":11,"end_column":39}],"ctx":"Load"}},"filename":"config_expr-03.k","line":10,"column":15,"end_line":12,"end_column":9},"operation":"Insert","insert_index":-1},"filename":"config_expr-03.k","line":10,"column":8,"end_line":12,"end_column":9}]}},"filename":"config_expr-03.k","line":9,"column":10,"end_line":13,"end_column":5},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":9,"column":4,"end_line":13,"end_column":5}]}},"filename":"config_expr-03.k","line":3,"column":9,"end_line":14,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-03.k","line":3,"column":0,"end_line":14,"end_column":1}],"comments":[{"node":{"text":"# test/grammar/attr_operator/config_inside/insert/dict_0/main.k"},"filename":"config_expr-03.k","line":1,"column":0,"end_line":1,"end_column":63}]} +{"filename":"config_expr-03.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"config","filename":"config_expr-03.k","line":3,"column":0,"end_line":3,"end_column":6}],"pkgpath":"","ctx":"Store"},"filename":"config_expr-03.k","line":3,"column":0,"end_line":3,"end_column":6}],"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"main","filename":"config_expr-03.k","line":4,"column":4,"end_line":4,"end_column":8}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":4,"column":4,"end_line":4,"end_column":8},"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"env","filename":"config_expr-03.k","line":5,"column":8,"end_line":5,"end_column":11}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":5,"column":8,"end_line":5,"end_column":11},"value":{"node":{"List":{"elts":[{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"name","filename":"config_expr-03.k","line":6,"column":13,"end_line":6,"end_column":17}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":6,"column":13,"end_line":6,"end_column":17},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"ENV_1\"","value":"ENV_1"}},"filename":"config_expr-03.k","line":6,"column":19,"end_line":6,"end_column":26},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":6,"column":13,"end_line":6,"end_column":26},{"node":{"key":{"node":{"Identifier":{"names":[{"node":"value","filename":"config_expr-03.k","line":6,"column":28,"end_line":6,"end_column":33}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":6,"column":28,"end_line":6,"end_column":33},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"1\"","value":"1"}},"filename":"config_expr-03.k","line":6,"column":35,"end_line":6,"end_column":38},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":6,"column":28,"end_line":6,"end_column":38}]}},"filename":"config_expr-03.k","line":6,"column":12,"end_line":6,"end_column":39}],"ctx":"Load"}},"filename":"config_expr-03.k","line":5,"column":13,"end_line":7,"end_column":9},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":5,"column":8,"end_line":7,"end_column":9}]}},"filename":"config_expr-03.k","line":4,"column":10,"end_line":8,"end_column":5},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":4,"column":4,"end_line":8,"end_column":5},{"node":{"key":{"node":{"Identifier":{"names":[{"node":"main","filename":"config_expr-03.k","line":9,"column":4,"end_line":9,"end_column":8}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":9,"column":4,"end_line":9,"end_column":8},"value":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"env","filename":"config_expr-03.k","line":10,"column":8,"end_line":10,"end_column":11}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":10,"column":8,"end_line":10,"end_column":11},"value":{"node":{"List":{"elts":[{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"name","filename":"config_expr-03.k","line":11,"column":13,"end_line":11,"end_column":17}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":11,"column":13,"end_line":11,"end_column":17},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"ENV_2\"","value":"ENV_2"}},"filename":"config_expr-03.k","line":11,"column":19,"end_line":11,"end_column":26},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":11,"column":13,"end_line":11,"end_column":26},{"node":{"key":{"node":{"Identifier":{"names":[{"node":"value","filename":"config_expr-03.k","line":11,"column":28,"end_line":11,"end_column":33}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-03.k","line":11,"column":28,"end_line":11,"end_column":33},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"2\"","value":"2"}},"filename":"config_expr-03.k","line":11,"column":35,"end_line":11,"end_column":38},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":11,"column":28,"end_line":11,"end_column":38}]}},"filename":"config_expr-03.k","line":11,"column":12,"end_line":11,"end_column":39}],"ctx":"Load"}},"filename":"config_expr-03.k","line":10,"column":15,"end_line":12,"end_column":9},"operation":"Insert","insert_index":-1},"filename":"config_expr-03.k","line":10,"column":8,"end_line":12,"end_column":9}]}},"filename":"config_expr-03.k","line":9,"column":10,"end_line":13,"end_column":5},"operation":"Union","insert_index":-1},"filename":"config_expr-03.k","line":9,"column":4,"end_line":13,"end_column":5}]}},"filename":"config_expr-03.k","line":3,"column":9,"end_line":14,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-03.k","line":3,"column":0,"end_line":14,"end_column":1}],"comments":[{"node":{"text":"# test/grammar/attr_operator/config_inside/insert/dict_0/main.k"},"filename":"config_expr-03.k","line":1,"column":0,"end_line":1,"end_column":63}]} \ No newline at end of file diff --git a/kclvm/parser/testdata/config_expr-04.k.json b/kclvm/parser/testdata/config_expr-04.k.json index a52a324dc..9d1547d94 100644 --- a/kclvm/parser/testdata/config_expr-04.k.json +++ b/kclvm/parser/testdata/config_expr-04.k.json @@ -1 +1 @@ -{"filename":"config_expr-04.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Schema":{"doc":"","name":{"node":"Env","filename":"config_expr-04.k","line":3,"column":7,"end_line":3,"end_column":10},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"SchemaAttr":{"doc":"","name":{"node":"name","filename":"config_expr-04.k","line":4,"column":4,"end_line":4,"end_column":8},"type_str":{"node":"str","filename":"config_expr-04.k","line":4,"column":10,"end_line":4,"end_column":13},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"config_expr-04.k","line":4,"column":10,"end_line":4,"end_column":13}}},"filename":"config_expr-04.k","line":4,"column":4,"end_line":4,"end_column":13},{"node":{"SchemaAttr":{"doc":"","name":{"node":"value","filename":"config_expr-04.k","line":5,"column":4,"end_line":5,"end_column":9},"type_str":{"node":"str","filename":"config_expr-04.k","line":5,"column":11,"end_line":5,"end_column":14},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"config_expr-04.k","line":5,"column":11,"end_line":5,"end_column":14}}},"filename":"config_expr-04.k","line":5,"column":4,"end_line":5,"end_column":14}],"decorators":[],"checks":[],"index_signature":null}},"filename":"config_expr-04.k","line":3,"column":0,"end_line":7,"end_column":0},{"node":{"Schema":{"doc":"","name":{"node":"Main","filename":"config_expr-04.k","line":7,"column":7,"end_line":7,"end_column":11},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"SchemaAttr":{"doc":"","name":{"node":"env","filename":"config_expr-04.k","line":8,"column":4,"end_line":8,"end_column":7},"type_str":{"node":"[Env]","filename":"config_expr-04.k","line":8,"column":9,"end_line":8,"end_column":14},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"List":{"inner_type":{"node":{"Named":{"names":["Env"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":8,"column":10,"end_line":8,"end_column":13}}},"filename":"config_expr-04.k","line":8,"column":9,"end_line":8,"end_column":14}}},"filename":"config_expr-04.k","line":8,"column":4,"end_line":8,"end_column":14}],"decorators":[],"checks":[],"index_signature":null}},"filename":"config_expr-04.k","line":7,"column":0,"end_line":10,"end_column":0},{"node":{"Schema":{"doc":"","name":{"node":"Config","filename":"config_expr-04.k","line":10,"column":7,"end_line":10,"end_column":13},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"SchemaAttr":{"doc":"","name":{"node":"main","filename":"config_expr-04.k","line":11,"column":4,"end_line":11,"end_column":8},"type_str":{"node":"Main","filename":"config_expr-04.k","line":11,"column":10,"end_line":11,"end_column":14},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"Named":{"names":["Main"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":11,"column":10,"end_line":11,"end_column":14}}},"filename":"config_expr-04.k","line":11,"column":4,"end_line":11,"end_column":14}],"decorators":[],"checks":[],"index_signature":null}},"filename":"config_expr-04.k","line":10,"column":0,"end_line":13,"end_column":0},{"node":{"Assign":{"targets":[{"node":{"names":["_main"],"pkgpath":"","ctx":"Store"},"filename":"config_expr-04.k","line":13,"column":0,"end_line":13,"end_column":5}],"value":{"node":{"Schema":{"name":{"node":{"names":["Main"],"pkgpath":"","ctx":"Load"},"filename":"config_expr-04.k","line":13,"column":8,"end_line":13,"end_column":12},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["env"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":14,"column":4,"end_line":14,"end_column":7},"value":{"node":{"List":{"elts":[{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["name"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":15,"column":9,"end_line":15,"end_column":13},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"ENV_1\"","value":"ENV_1"}},"filename":"config_expr-04.k","line":15,"column":15,"end_line":15,"end_column":22},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":15,"column":9,"end_line":15,"end_column":22},{"node":{"key":{"node":{"Identifier":{"names":["value"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":15,"column":24,"end_line":15,"end_column":29},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"1\"","value":"1"}},"filename":"config_expr-04.k","line":15,"column":31,"end_line":15,"end_column":34},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":15,"column":24,"end_line":15,"end_column":34}]}},"filename":"config_expr-04.k","line":15,"column":8,"end_line":15,"end_column":35}],"ctx":"Load"}},"filename":"config_expr-04.k","line":14,"column":9,"end_line":16,"end_column":5},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":14,"column":4,"end_line":16,"end_column":5}]}},"filename":"config_expr-04.k","line":13,"column":13,"end_line":17,"end_column":1}}},"filename":"config_expr-04.k","line":13,"column":8,"end_line":17,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-04.k","line":13,"column":0,"end_line":17,"end_column":1},{"node":{"Assign":{"targets":[{"node":{"names":["config"],"pkgpath":"","ctx":"Store"},"filename":"config_expr-04.k","line":19,"column":0,"end_line":19,"end_column":6}],"value":{"node":{"Schema":{"name":{"node":{"names":["Config"],"pkgpath":"","ctx":"Load"},"filename":"config_expr-04.k","line":19,"column":9,"end_line":19,"end_column":15},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["main"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":20,"column":4,"end_line":20,"end_column":8},"value":{"node":{"Identifier":{"names":["_main"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":20,"column":10,"end_line":20,"end_column":15},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":20,"column":4,"end_line":20,"end_column":15},{"node":{"key":{"node":{"Identifier":{"names":["main"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":21,"column":4,"end_line":21,"end_column":8},"value":{"node":{"Schema":{"name":{"node":{"names":["Main"],"pkgpath":"","ctx":"Load"},"filename":"config_expr-04.k","line":21,"column":10,"end_line":21,"end_column":14},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["env"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":22,"column":8,"end_line":22,"end_column":11},"value":{"node":{"List":{"elts":[{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":["name"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":23,"column":13,"end_line":23,"end_column":17},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"ENV_2\"","value":"ENV_2"}},"filename":"config_expr-04.k","line":23,"column":19,"end_line":23,"end_column":26},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":23,"column":13,"end_line":23,"end_column":26},{"node":{"key":{"node":{"Identifier":{"names":["value"],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":23,"column":28,"end_line":23,"end_column":33},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"2\"","value":"2"}},"filename":"config_expr-04.k","line":23,"column":35,"end_line":23,"end_column":38},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":23,"column":28,"end_line":23,"end_column":38}]}},"filename":"config_expr-04.k","line":23,"column":12,"end_line":23,"end_column":39}],"ctx":"Load"}},"filename":"config_expr-04.k","line":22,"column":15,"end_line":24,"end_column":9},"operation":"Insert","insert_index":-1},"filename":"config_expr-04.k","line":22,"column":8,"end_line":24,"end_column":9}]}},"filename":"config_expr-04.k","line":21,"column":15,"end_line":25,"end_column":5}}},"filename":"config_expr-04.k","line":21,"column":10,"end_line":25,"end_column":5},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":21,"column":4,"end_line":25,"end_column":5}]}},"filename":"config_expr-04.k","line":19,"column":16,"end_line":26,"end_column":1}}},"filename":"config_expr-04.k","line":19,"column":9,"end_line":26,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-04.k","line":19,"column":0,"end_line":26,"end_column":1}],"comments":[{"node":{"text":"# test/grammar/attr_operator/config_inside/insert/schema_0/main.k"},"filename":"config_expr-04.k","line":1,"column":0,"end_line":1,"end_column":65}]} +{"filename":"config_expr-04.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Schema":{"doc":"","name":{"node":"Env","filename":"config_expr-04.k","line":3,"column":7,"end_line":3,"end_column":10},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"SchemaAttr":{"doc":"","name":{"node":"name","filename":"config_expr-04.k","line":4,"column":4,"end_line":4,"end_column":8},"type_str":{"node":"str","filename":"config_expr-04.k","line":4,"column":10,"end_line":4,"end_column":13},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"config_expr-04.k","line":4,"column":10,"end_line":4,"end_column":13}}},"filename":"config_expr-04.k","line":4,"column":4,"end_line":4,"end_column":13},{"node":{"SchemaAttr":{"doc":"","name":{"node":"value","filename":"config_expr-04.k","line":5,"column":4,"end_line":5,"end_column":9},"type_str":{"node":"str","filename":"config_expr-04.k","line":5,"column":11,"end_line":5,"end_column":14},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"config_expr-04.k","line":5,"column":11,"end_line":5,"end_column":14}}},"filename":"config_expr-04.k","line":5,"column":4,"end_line":5,"end_column":14}],"decorators":[],"checks":[],"index_signature":null}},"filename":"config_expr-04.k","line":3,"column":0,"end_line":7,"end_column":0},{"node":{"Schema":{"doc":"","name":{"node":"Main","filename":"config_expr-04.k","line":7,"column":7,"end_line":7,"end_column":11},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"SchemaAttr":{"doc":"","name":{"node":"env","filename":"config_expr-04.k","line":8,"column":4,"end_line":8,"end_column":7},"type_str":{"node":"[Env]","filename":"config_expr-04.k","line":8,"column":9,"end_line":8,"end_column":14},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"List":{"inner_type":{"node":{"Named":{"names":[{"node":"Env","filename":"config_expr-04.k","line":8,"column":10,"end_line":8,"end_column":13}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":8,"column":10,"end_line":8,"end_column":13}}},"filename":"config_expr-04.k","line":8,"column":9,"end_line":8,"end_column":14}}},"filename":"config_expr-04.k","line":8,"column":4,"end_line":8,"end_column":14}],"decorators":[],"checks":[],"index_signature":null}},"filename":"config_expr-04.k","line":7,"column":0,"end_line":10,"end_column":0},{"node":{"Schema":{"doc":"","name":{"node":"Config","filename":"config_expr-04.k","line":10,"column":7,"end_line":10,"end_column":13},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"SchemaAttr":{"doc":"","name":{"node":"main","filename":"config_expr-04.k","line":11,"column":4,"end_line":11,"end_column":8},"type_str":{"node":"Main","filename":"config_expr-04.k","line":11,"column":10,"end_line":11,"end_column":14},"op":null,"value":null,"is_optional":false,"decorators":[],"ty":{"node":{"Named":{"names":[{"node":"Main","filename":"config_expr-04.k","line":11,"column":10,"end_line":11,"end_column":14}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":11,"column":10,"end_line":11,"end_column":14}}},"filename":"config_expr-04.k","line":11,"column":4,"end_line":11,"end_column":14}],"decorators":[],"checks":[],"index_signature":null}},"filename":"config_expr-04.k","line":10,"column":0,"end_line":13,"end_column":0},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"_main","filename":"config_expr-04.k","line":13,"column":0,"end_line":13,"end_column":5}],"pkgpath":"","ctx":"Store"},"filename":"config_expr-04.k","line":13,"column":0,"end_line":13,"end_column":5}],"value":{"node":{"Schema":{"name":{"node":{"names":[{"node":"Main","filename":"config_expr-04.k","line":13,"column":8,"end_line":13,"end_column":12}],"pkgpath":"","ctx":"Load"},"filename":"config_expr-04.k","line":13,"column":8,"end_line":13,"end_column":12},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"env","filename":"config_expr-04.k","line":14,"column":4,"end_line":14,"end_column":7}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":14,"column":4,"end_line":14,"end_column":7},"value":{"node":{"List":{"elts":[{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"name","filename":"config_expr-04.k","line":15,"column":9,"end_line":15,"end_column":13}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":15,"column":9,"end_line":15,"end_column":13},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"ENV_1\"","value":"ENV_1"}},"filename":"config_expr-04.k","line":15,"column":15,"end_line":15,"end_column":22},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":15,"column":9,"end_line":15,"end_column":22},{"node":{"key":{"node":{"Identifier":{"names":[{"node":"value","filename":"config_expr-04.k","line":15,"column":24,"end_line":15,"end_column":29}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":15,"column":24,"end_line":15,"end_column":29},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"1\"","value":"1"}},"filename":"config_expr-04.k","line":15,"column":31,"end_line":15,"end_column":34},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":15,"column":24,"end_line":15,"end_column":34}]}},"filename":"config_expr-04.k","line":15,"column":8,"end_line":15,"end_column":35}],"ctx":"Load"}},"filename":"config_expr-04.k","line":14,"column":9,"end_line":16,"end_column":5},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":14,"column":4,"end_line":16,"end_column":5}]}},"filename":"config_expr-04.k","line":13,"column":13,"end_line":17,"end_column":1}}},"filename":"config_expr-04.k","line":13,"column":8,"end_line":17,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-04.k","line":13,"column":0,"end_line":17,"end_column":1},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"config","filename":"config_expr-04.k","line":19,"column":0,"end_line":19,"end_column":6}],"pkgpath":"","ctx":"Store"},"filename":"config_expr-04.k","line":19,"column":0,"end_line":19,"end_column":6}],"value":{"node":{"Schema":{"name":{"node":{"names":[{"node":"Config","filename":"config_expr-04.k","line":19,"column":9,"end_line":19,"end_column":15}],"pkgpath":"","ctx":"Load"},"filename":"config_expr-04.k","line":19,"column":9,"end_line":19,"end_column":15},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"main","filename":"config_expr-04.k","line":20,"column":4,"end_line":20,"end_column":8}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":20,"column":4,"end_line":20,"end_column":8},"value":{"node":{"Identifier":{"names":[{"node":"_main","filename":"config_expr-04.k","line":20,"column":10,"end_line":20,"end_column":15}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":20,"column":10,"end_line":20,"end_column":15},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":20,"column":4,"end_line":20,"end_column":15},{"node":{"key":{"node":{"Identifier":{"names":[{"node":"main","filename":"config_expr-04.k","line":21,"column":4,"end_line":21,"end_column":8}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":21,"column":4,"end_line":21,"end_column":8},"value":{"node":{"Schema":{"name":{"node":{"names":[{"node":"Main","filename":"config_expr-04.k","line":21,"column":10,"end_line":21,"end_column":14}],"pkgpath":"","ctx":"Load"},"filename":"config_expr-04.k","line":21,"column":10,"end_line":21,"end_column":14},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"env","filename":"config_expr-04.k","line":22,"column":8,"end_line":22,"end_column":11}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":22,"column":8,"end_line":22,"end_column":11},"value":{"node":{"List":{"elts":[{"node":{"Config":{"items":[{"node":{"key":{"node":{"Identifier":{"names":[{"node":"name","filename":"config_expr-04.k","line":23,"column":13,"end_line":23,"end_column":17}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":23,"column":13,"end_line":23,"end_column":17},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"ENV_2\"","value":"ENV_2"}},"filename":"config_expr-04.k","line":23,"column":19,"end_line":23,"end_column":26},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":23,"column":13,"end_line":23,"end_column":26},{"node":{"key":{"node":{"Identifier":{"names":[{"node":"value","filename":"config_expr-04.k","line":23,"column":28,"end_line":23,"end_column":33}],"pkgpath":"","ctx":"Load"}},"filename":"config_expr-04.k","line":23,"column":28,"end_line":23,"end_column":33},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"2\"","value":"2"}},"filename":"config_expr-04.k","line":23,"column":35,"end_line":23,"end_column":38},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":23,"column":28,"end_line":23,"end_column":38}]}},"filename":"config_expr-04.k","line":23,"column":12,"end_line":23,"end_column":39}],"ctx":"Load"}},"filename":"config_expr-04.k","line":22,"column":15,"end_line":24,"end_column":9},"operation":"Insert","insert_index":-1},"filename":"config_expr-04.k","line":22,"column":8,"end_line":24,"end_column":9}]}},"filename":"config_expr-04.k","line":21,"column":15,"end_line":25,"end_column":5}}},"filename":"config_expr-04.k","line":21,"column":10,"end_line":25,"end_column":5},"operation":"Union","insert_index":-1},"filename":"config_expr-04.k","line":21,"column":4,"end_line":25,"end_column":5}]}},"filename":"config_expr-04.k","line":19,"column":16,"end_line":26,"end_column":1}}},"filename":"config_expr-04.k","line":19,"column":9,"end_line":26,"end_column":1},"type_annotation":null,"ty":null}},"filename":"config_expr-04.k","line":19,"column":0,"end_line":26,"end_column":1}],"comments":[{"node":{"text":"# test/grammar/attr_operator/config_inside/insert/schema_0/main.k"},"filename":"config_expr-04.k","line":1,"column":0,"end_line":1,"end_column":65}]} \ No newline at end of file diff --git a/kclvm/parser/testdata/hello_win.k.json b/kclvm/parser/testdata/hello_win.k.json index 6693c2dad..ba85b5d17 100644 --- a/kclvm/parser/testdata/hello_win.k.json +++ b/kclvm/parser/testdata/hello_win.k.json @@ -1 +1 @@ -{"filename":"hello_win.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Schema":{"doc":"","name":{"node":"Person","filename":"hello_win.k","line":2,"column":7,"end_line":2,"end_column":13},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"SchemaAttr":{"doc":"","name":{"node":"name","filename":"hello_win.k","line":3,"column":4,"end_line":3,"end_column":8},"type_str":{"node":"str","filename":"hello_win.k","line":3,"column":10,"end_line":3,"end_column":13},"op":{"Aug":"Assign"},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"kcl\"","value":"kcl"}},"filename":"hello_win.k","line":3,"column":16,"end_line":3,"end_column":21},"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"hello_win.k","line":3,"column":10,"end_line":3,"end_column":13}}},"filename":"hello_win.k","line":3,"column":4,"end_line":3,"end_column":21}],"decorators":[],"checks":[],"index_signature":null}},"filename":"hello_win.k","line":2,"column":0,"end_line":5,"end_column":0},{"node":{"Assign":{"targets":[{"node":{"names":["x0"],"pkgpath":"","ctx":"Store"},"filename":"hello_win.k","line":5,"column":0,"end_line":5,"end_column":2}],"value":{"node":{"Schema":{"name":{"node":{"names":["Person"],"pkgpath":"","ctx":"Load"},"filename":"hello_win.k","line":5,"column":5,"end_line":5,"end_column":11},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[]}},"filename":"hello_win.k","line":5,"column":12,"end_line":5,"end_column":14}}},"filename":"hello_win.k","line":5,"column":5,"end_line":5,"end_column":14},"type_annotation":null,"ty":null}},"filename":"hello_win.k","line":5,"column":0,"end_line":5,"end_column":14}],"comments":[]} +{"filename":"hello_win.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Schema":{"doc":"","name":{"node":"Person","filename":"hello_win.k","line":2,"column":7,"end_line":2,"end_column":13},"parent_name":null,"for_host_name":null,"is_mixin":false,"is_protocol":false,"args":null,"mixins":[],"body":[{"node":{"SchemaAttr":{"doc":"","name":{"node":"name","filename":"hello_win.k","line":3,"column":4,"end_line":3,"end_column":8},"type_str":{"node":"str","filename":"hello_win.k","line":3,"column":10,"end_line":3,"end_column":13},"op":{"Aug":"Assign"},"value":{"node":{"StringLit":{"is_long_string":false,"raw_value":"\"kcl\"","value":"kcl"}},"filename":"hello_win.k","line":3,"column":16,"end_line":3,"end_column":21},"is_optional":false,"decorators":[],"ty":{"node":{"Basic":"Str"},"filename":"hello_win.k","line":3,"column":10,"end_line":3,"end_column":13}}},"filename":"hello_win.k","line":3,"column":4,"end_line":3,"end_column":21}],"decorators":[],"checks":[],"index_signature":null}},"filename":"hello_win.k","line":2,"column":0,"end_line":5,"end_column":0},{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"x0","filename":"hello_win.k","line":5,"column":0,"end_line":5,"end_column":2}],"pkgpath":"","ctx":"Store"},"filename":"hello_win.k","line":5,"column":0,"end_line":5,"end_column":2}],"value":{"node":{"Schema":{"name":{"node":{"names":[{"node":"Person","filename":"hello_win.k","line":5,"column":5,"end_line":5,"end_column":11}],"pkgpath":"","ctx":"Load"},"filename":"hello_win.k","line":5,"column":5,"end_line":5,"end_column":11},"args":[],"kwargs":[],"config":{"node":{"Config":{"items":[]}},"filename":"hello_win.k","line":5,"column":12,"end_line":5,"end_column":14}}},"filename":"hello_win.k","line":5,"column":5,"end_line":5,"end_column":14},"type_annotation":null,"ty":null}},"filename":"hello_win.k","line":5,"column":0,"end_line":5,"end_column":14}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/if-01.k.json b/kclvm/parser/testdata/if-01.k.json index 0c994b60c..47793d460 100644 --- a/kclvm/parser/testdata/if-01.k.json +++ b/kclvm/parser/testdata/if-01.k.json @@ -1 +1 @@ -{"filename":"if-01.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Store"},"filename":"if-01.k","line":1,"column":0,"end_line":1,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"if-01.k","line":1,"column":4,"end_line":1,"end_column":5},"type_annotation":null,"ty":null}},"filename":"if-01.k","line":1,"column":0,"end_line":1,"end_column":5},{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":["bbb"],"pkgpath":"","ctx":"Store"},"filename":"if-01.k","line":4,"column":4,"end_line":4,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"if-01.k","line":4,"column":10,"end_line":4,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-01.k","line":4,"column":4,"end_line":4,"end_column":11}],"cond":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"if-01.k","line":3,"column":3,"end_line":3,"end_column":4},"orelse":[]}},"filename":"if-01.k","line":3,"column":0,"end_line":4,"end_column":12}],"comments":[]} +{"filename":"if-01.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"a","filename":"if-01.k","line":1,"column":0,"end_line":1,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"if-01.k","line":1,"column":0,"end_line":1,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"if-01.k","line":1,"column":4,"end_line":1,"end_column":5},"type_annotation":null,"ty":null}},"filename":"if-01.k","line":1,"column":0,"end_line":1,"end_column":5},{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"bbb","filename":"if-01.k","line":4,"column":4,"end_line":4,"end_column":7}],"pkgpath":"","ctx":"Store"},"filename":"if-01.k","line":4,"column":4,"end_line":4,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"if-01.k","line":4,"column":10,"end_line":4,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-01.k","line":4,"column":4,"end_line":4,"end_column":11}],"cond":{"node":{"Identifier":{"names":[{"node":"a","filename":"if-01.k","line":3,"column":3,"end_line":3,"end_column":4}],"pkgpath":"","ctx":"Load"}},"filename":"if-01.k","line":3,"column":3,"end_line":3,"end_column":4},"orelse":[]}},"filename":"if-01.k","line":3,"column":0,"end_line":4,"end_column":12}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/if-02.k.json b/kclvm/parser/testdata/if-02.k.json index 7a811ea94..2ee621a14 100644 --- a/kclvm/parser/testdata/if-02.k.json +++ b/kclvm/parser/testdata/if-02.k.json @@ -1 +1 @@ -{"filename":"if-02.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":1,"column":0,"end_line":1,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"if-02.k","line":1,"column":4,"end_line":1,"end_column":5},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":1,"column":0,"end_line":1,"end_column":5},{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":["bbb"],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":4,"column":4,"end_line":4,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"if-02.k","line":4,"column":10,"end_line":4,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":4,"column":4,"end_line":4,"end_column":11}],"cond":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"if-02.k","line":3,"column":3,"end_line":3,"end_column":4},"orelse":[{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":["ccc"],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":6,"column":4,"end_line":6,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"if-02.k","line":6,"column":10,"end_line":6,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":6,"column":4,"end_line":6,"end_column":11}],"cond":{"node":{"Binary":{"left":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"if-02.k","line":5,"column":5,"end_line":5,"end_column":6},"op":{"Bin":"Add"},"right":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":10}}},"filename":"if-02.k","line":5,"column":9,"end_line":5,"end_column":11}}},"filename":"if-02.k","line":5,"column":5,"end_line":5,"end_column":11},"orelse":[{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":["ddd"],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":8,"column":4,"end_line":8,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":4}}},"filename":"if-02.k","line":8,"column":10,"end_line":8,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":8,"column":4,"end_line":8,"end_column":11}],"cond":{"node":{"Binary":{"left":{"node":{"Identifier":{"names":["a"],"pkgpath":"","ctx":"Load"}},"filename":"if-02.k","line":7,"column":5,"end_line":7,"end_column":6},"op":{"Bin":"Add"},"right":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":100}}},"filename":"if-02.k","line":7,"column":9,"end_line":7,"end_column":12}}},"filename":"if-02.k","line":7,"column":5,"end_line":7,"end_column":12},"orelse":[{"node":{"Assign":{"targets":[{"node":{"names":["eee"],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":10,"column":4,"end_line":10,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":5}}},"filename":"if-02.k","line":10,"column":10,"end_line":10,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":10,"column":4,"end_line":10,"end_column":11}]}},"filename":"if-02.k","line":7,"column":0,"end_line":9,"end_column":0}]}},"filename":"if-02.k","line":5,"column":0,"end_line":7,"end_column":0}]}},"filename":"if-02.k","line":3,"column":0,"end_line":10,"end_column":12}],"comments":[]} +{"filename":"if-02.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"a","filename":"if-02.k","line":1,"column":0,"end_line":1,"end_column":1}],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":1,"column":0,"end_line":1,"end_column":1}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"if-02.k","line":1,"column":4,"end_line":1,"end_column":5},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":1,"column":0,"end_line":1,"end_column":5},{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"bbb","filename":"if-02.k","line":4,"column":4,"end_line":4,"end_column":7}],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":4,"column":4,"end_line":4,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":2}}},"filename":"if-02.k","line":4,"column":10,"end_line":4,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":4,"column":4,"end_line":4,"end_column":11}],"cond":{"node":{"Identifier":{"names":[{"node":"a","filename":"if-02.k","line":3,"column":3,"end_line":3,"end_column":4}],"pkgpath":"","ctx":"Load"}},"filename":"if-02.k","line":3,"column":3,"end_line":3,"end_column":4},"orelse":[{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"ccc","filename":"if-02.k","line":6,"column":4,"end_line":6,"end_column":7}],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":6,"column":4,"end_line":6,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":3}}},"filename":"if-02.k","line":6,"column":10,"end_line":6,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":6,"column":4,"end_line":6,"end_column":11}],"cond":{"node":{"Binary":{"left":{"node":{"Identifier":{"names":[{"node":"a","filename":"if-02.k","line":5,"column":5,"end_line":5,"end_column":6}],"pkgpath":"","ctx":"Load"}},"filename":"if-02.k","line":5,"column":5,"end_line":5,"end_column":6},"op":{"Bin":"Add"},"right":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":10}}},"filename":"if-02.k","line":5,"column":9,"end_line":5,"end_column":11}}},"filename":"if-02.k","line":5,"column":5,"end_line":5,"end_column":11},"orelse":[{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"ddd","filename":"if-02.k","line":8,"column":4,"end_line":8,"end_column":7}],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":8,"column":4,"end_line":8,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":4}}},"filename":"if-02.k","line":8,"column":10,"end_line":8,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":8,"column":4,"end_line":8,"end_column":11}],"cond":{"node":{"Binary":{"left":{"node":{"Identifier":{"names":[{"node":"a","filename":"if-02.k","line":7,"column":5,"end_line":7,"end_column":6}],"pkgpath":"","ctx":"Load"}},"filename":"if-02.k","line":7,"column":5,"end_line":7,"end_column":6},"op":{"Bin":"Add"},"right":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":100}}},"filename":"if-02.k","line":7,"column":9,"end_line":7,"end_column":12}}},"filename":"if-02.k","line":7,"column":5,"end_line":7,"end_column":12},"orelse":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"eee","filename":"if-02.k","line":10,"column":4,"end_line":10,"end_column":7}],"pkgpath":"","ctx":"Store"},"filename":"if-02.k","line":10,"column":4,"end_line":10,"end_column":7}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":5}}},"filename":"if-02.k","line":10,"column":10,"end_line":10,"end_column":11},"type_annotation":null,"ty":null}},"filename":"if-02.k","line":10,"column":4,"end_line":10,"end_column":11}]}},"filename":"if-02.k","line":7,"column":0,"end_line":9,"end_column":0}]}},"filename":"if-02.k","line":5,"column":0,"end_line":7,"end_column":0}]}},"filename":"if-02.k","line":3,"column":0,"end_line":10,"end_column":12}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/if-03.k.json b/kclvm/parser/testdata/if-03.k.json index b59063d18..c46bdb72e 100644 --- a/kclvm/parser/testdata/if-03.k.json +++ b/kclvm/parser/testdata/if-03.k.json @@ -1 +1 @@ -{"filename":"if-03.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":["a"],"pkgpath":"","ctx":"Store"},"filename":"if-03.k","line":1,"column":9,"end_line":1,"end_column":10}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"if-03.k","line":1,"column":13,"end_line":1,"end_column":14},"type_annotation":null,"ty":null}},"filename":"if-03.k","line":1,"column":9,"end_line":1,"end_column":14}],"cond":{"node":{"NameConstantLit":{"value":"True"}},"filename":"if-03.k","line":1,"column":3,"end_line":1,"end_column":7},"orelse":[]}},"filename":"if-03.k","line":1,"column":0,"end_line":1,"end_column":15}],"comments":[]} +{"filename":"if-03.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"If":{"body":[{"node":{"Assign":{"targets":[{"node":{"names":[{"node":"a","filename":"if-03.k","line":1,"column":9,"end_line":1,"end_column":10}],"pkgpath":"","ctx":"Store"},"filename":"if-03.k","line":1,"column":9,"end_line":1,"end_column":10}],"value":{"node":{"NumberLit":{"binary_suffix":null,"value":{"Int":1}}},"filename":"if-03.k","line":1,"column":13,"end_line":1,"end_column":14},"type_annotation":null,"ty":null}},"filename":"if-03.k","line":1,"column":9,"end_line":1,"end_column":14}],"cond":{"node":{"NameConstantLit":{"value":"True"}},"filename":"if-03.k","line":1,"column":3,"end_line":1,"end_column":7},"orelse":[]}},"filename":"if-03.k","line":1,"column":0,"end_line":1,"end_column":15}],"comments":[]} \ No newline at end of file diff --git a/kclvm/parser/testdata/type-01.k.json b/kclvm/parser/testdata/type-01.k.json index 546806291..aca41c1fb 100644 --- a/kclvm/parser/testdata/type-01.k.json +++ b/kclvm/parser/testdata/type-01.k.json @@ -1 +1 @@ -{"filename":"type-01.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"TypeAlias":{"type_name":{"node":{"names":["a"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":1,"column":5,"end_line":1,"end_column":6},"type_value":{"node":"any","filename":"type-01.k","line":1,"column":9,"end_line":1,"end_column":12},"ty":{"node":"Any","filename":"type-01.k","line":1,"column":9,"end_line":1,"end_column":12}}},"filename":"type-01.k","line":1,"column":5,"end_line":1,"end_column":12},{"node":{"TypeAlias":{"type_name":{"node":{"names":["b"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":3,"column":5,"end_line":3,"end_column":6},"type_value":{"node":"bool","filename":"type-01.k","line":3,"column":9,"end_line":3,"end_column":13},"ty":{"node":{"Basic":"Bool"},"filename":"type-01.k","line":3,"column":9,"end_line":3,"end_column":13}}},"filename":"type-01.k","line":3,"column":5,"end_line":3,"end_column":13},{"node":{"TypeAlias":{"type_name":{"node":{"names":["c"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":4,"column":5,"end_line":4,"end_column":6},"type_value":{"node":"int","filename":"type-01.k","line":4,"column":9,"end_line":4,"end_column":12},"ty":{"node":{"Basic":"Int"},"filename":"type-01.k","line":4,"column":9,"end_line":4,"end_column":12}}},"filename":"type-01.k","line":4,"column":5,"end_line":4,"end_column":12},{"node":{"TypeAlias":{"type_name":{"node":{"names":["d"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":5,"column":5,"end_line":5,"end_column":6},"type_value":{"node":"float","filename":"type-01.k","line":5,"column":9,"end_line":5,"end_column":14},"ty":{"node":{"Basic":"Float"},"filename":"type-01.k","line":5,"column":9,"end_line":5,"end_column":14}}},"filename":"type-01.k","line":5,"column":5,"end_line":5,"end_column":14},{"node":{"TypeAlias":{"type_name":{"node":{"names":["e"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":6,"column":5,"end_line":6,"end_column":6},"type_value":{"node":"str","filename":"type-01.k","line":6,"column":9,"end_line":6,"end_column":12},"ty":{"node":{"Basic":"Str"},"filename":"type-01.k","line":6,"column":9,"end_line":6,"end_column":12}}},"filename":"type-01.k","line":6,"column":5,"end_line":6,"end_column":12},{"node":{"TypeAlias":{"type_name":{"node":{"names":["type_list1"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":8,"column":5,"end_line":8,"end_column":15},"type_value":{"node":"[]","filename":"type-01.k","line":8,"column":18,"end_line":8,"end_column":20},"ty":{"node":{"List":{"inner_type":null}},"filename":"type-01.k","line":8,"column":18,"end_line":8,"end_column":20}}},"filename":"type-01.k","line":8,"column":5,"end_line":8,"end_column":20},{"node":{"TypeAlias":{"type_name":{"node":{"names":["type_list2"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":9,"column":5,"end_line":9,"end_column":15},"type_value":{"node":"[[]]","filename":"type-01.k","line":9,"column":18,"end_line":9,"end_column":22},"ty":{"node":{"List":{"inner_type":{"node":{"List":{"inner_type":null}},"filename":"type-01.k","line":9,"column":19,"end_line":9,"end_column":21}}},"filename":"type-01.k","line":9,"column":18,"end_line":9,"end_column":22}}},"filename":"type-01.k","line":9,"column":5,"end_line":9,"end_column":22},{"node":{"TypeAlias":{"type_name":{"node":{"names":["type_list3"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":10,"column":5,"end_line":10,"end_column":15},"type_value":{"node":"[int]","filename":"type-01.k","line":10,"column":18,"end_line":10,"end_column":23},"ty":{"node":{"List":{"inner_type":{"node":{"Basic":"Int"},"filename":"type-01.k","line":10,"column":19,"end_line":10,"end_column":22}}},"filename":"type-01.k","line":10,"column":18,"end_line":10,"end_column":23}}},"filename":"type-01.k","line":10,"column":5,"end_line":10,"end_column":23},{"node":{"TypeAlias":{"type_name":{"node":{"names":["b"],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":12,"column":5,"end_line":12,"end_column":6},"type_value":{"node":"int|str|[]|{:}","filename":"type-01.k","line":12,"column":9,"end_line":12,"end_column":29},"ty":{"node":{"Union":{"type_elements":[{"node":{"Basic":"Int"},"filename":"type-01.k","line":12,"column":9,"end_line":12,"end_column":12},{"node":{"Basic":"Str"},"filename":"type-01.k","line":12,"column":15,"end_line":12,"end_column":18},{"node":{"List":{"inner_type":null}},"filename":"type-01.k","line":12,"column":21,"end_line":12,"end_column":23},{"node":{"Dict":{"key_type":null,"value_type":null}},"filename":"type-01.k","line":12,"column":26,"end_line":12,"end_column":29}]}},"filename":"type-01.k","line":12,"column":9,"end_line":12,"end_column":29}}},"filename":"type-01.k","line":12,"column":5,"end_line":12,"end_column":29}],"comments":[]} +{"filename":"type-01.k","pkg":"__main__","doc":"","name":"__main__","body":[{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"a","filename":"type-01.k","line":1,"column":5,"end_line":1,"end_column":6}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":1,"column":5,"end_line":1,"end_column":6},"type_value":{"node":"any","filename":"type-01.k","line":1,"column":9,"end_line":1,"end_column":12},"ty":{"node":"Any","filename":"type-01.k","line":1,"column":9,"end_line":1,"end_column":12}}},"filename":"type-01.k","line":1,"column":5,"end_line":1,"end_column":12},{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"b","filename":"type-01.k","line":3,"column":5,"end_line":3,"end_column":6}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":3,"column":5,"end_line":3,"end_column":6},"type_value":{"node":"bool","filename":"type-01.k","line":3,"column":9,"end_line":3,"end_column":13},"ty":{"node":{"Basic":"Bool"},"filename":"type-01.k","line":3,"column":9,"end_line":3,"end_column":13}}},"filename":"type-01.k","line":3,"column":5,"end_line":3,"end_column":13},{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"c","filename":"type-01.k","line":4,"column":5,"end_line":4,"end_column":6}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":4,"column":5,"end_line":4,"end_column":6},"type_value":{"node":"int","filename":"type-01.k","line":4,"column":9,"end_line":4,"end_column":12},"ty":{"node":{"Basic":"Int"},"filename":"type-01.k","line":4,"column":9,"end_line":4,"end_column":12}}},"filename":"type-01.k","line":4,"column":5,"end_line":4,"end_column":12},{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"d","filename":"type-01.k","line":5,"column":5,"end_line":5,"end_column":6}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":5,"column":5,"end_line":5,"end_column":6},"type_value":{"node":"float","filename":"type-01.k","line":5,"column":9,"end_line":5,"end_column":14},"ty":{"node":{"Basic":"Float"},"filename":"type-01.k","line":5,"column":9,"end_line":5,"end_column":14}}},"filename":"type-01.k","line":5,"column":5,"end_line":5,"end_column":14},{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"e","filename":"type-01.k","line":6,"column":5,"end_line":6,"end_column":6}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":6,"column":5,"end_line":6,"end_column":6},"type_value":{"node":"str","filename":"type-01.k","line":6,"column":9,"end_line":6,"end_column":12},"ty":{"node":{"Basic":"Str"},"filename":"type-01.k","line":6,"column":9,"end_line":6,"end_column":12}}},"filename":"type-01.k","line":6,"column":5,"end_line":6,"end_column":12},{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"type_list1","filename":"type-01.k","line":8,"column":5,"end_line":8,"end_column":15}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":8,"column":5,"end_line":8,"end_column":15},"type_value":{"node":"[]","filename":"type-01.k","line":8,"column":18,"end_line":8,"end_column":20},"ty":{"node":{"List":{"inner_type":null}},"filename":"type-01.k","line":8,"column":18,"end_line":8,"end_column":20}}},"filename":"type-01.k","line":8,"column":5,"end_line":8,"end_column":20},{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"type_list2","filename":"type-01.k","line":9,"column":5,"end_line":9,"end_column":15}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":9,"column":5,"end_line":9,"end_column":15},"type_value":{"node":"[[]]","filename":"type-01.k","line":9,"column":18,"end_line":9,"end_column":22},"ty":{"node":{"List":{"inner_type":{"node":{"List":{"inner_type":null}},"filename":"type-01.k","line":9,"column":19,"end_line":9,"end_column":21}}},"filename":"type-01.k","line":9,"column":18,"end_line":9,"end_column":22}}},"filename":"type-01.k","line":9,"column":5,"end_line":9,"end_column":22},{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"type_list3","filename":"type-01.k","line":10,"column":5,"end_line":10,"end_column":15}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":10,"column":5,"end_line":10,"end_column":15},"type_value":{"node":"[int]","filename":"type-01.k","line":10,"column":18,"end_line":10,"end_column":23},"ty":{"node":{"List":{"inner_type":{"node":{"Basic":"Int"},"filename":"type-01.k","line":10,"column":19,"end_line":10,"end_column":22}}},"filename":"type-01.k","line":10,"column":18,"end_line":10,"end_column":23}}},"filename":"type-01.k","line":10,"column":5,"end_line":10,"end_column":23},{"node":{"TypeAlias":{"type_name":{"node":{"names":[{"node":"b","filename":"type-01.k","line":12,"column":5,"end_line":12,"end_column":6}],"pkgpath":"","ctx":"Load"},"filename":"type-01.k","line":12,"column":5,"end_line":12,"end_column":6},"type_value":{"node":"int|str|[]|{:}","filename":"type-01.k","line":12,"column":9,"end_line":12,"end_column":29},"ty":{"node":{"Union":{"type_elements":[{"node":{"Basic":"Int"},"filename":"type-01.k","line":12,"column":9,"end_line":12,"end_column":12},{"node":{"Basic":"Str"},"filename":"type-01.k","line":12,"column":15,"end_line":12,"end_column":18},{"node":{"List":{"inner_type":null}},"filename":"type-01.k","line":12,"column":21,"end_line":12,"end_column":23},{"node":{"Dict":{"key_type":null,"value_type":null}},"filename":"type-01.k","line":12,"column":26,"end_line":12,"end_column":29}]}},"filename":"type-01.k","line":12,"column":9,"end_line":12,"end_column":29}}},"filename":"type-01.k","line":12,"column":5,"end_line":12,"end_column":29}],"comments":[]} \ No newline at end of file diff --git a/kclvm/query/src/override.rs b/kclvm/query/src/override.rs index 8eed0b60d..091258968 100644 --- a/kclvm/query/src/override.rs +++ b/kclvm/query/src/override.rs @@ -112,7 +112,10 @@ pub fn apply_override_on_module( let field = ss[1..].join("."); let value = &o.field_value; let key = ast::Identifier { - names: field.split('.').map(|s| s.to_string()).collect(), + names: field + .split('.') + .map(|s| ast::Node::dummy_node(s.to_string())) + .collect(), ctx: ast::ExprContext::Store, pkgpath: "".to_string(), }; @@ -243,7 +246,7 @@ impl<'ctx> MutSelfMutWalker<'ctx> for OverrideTransformer { unification_stmt.target.node.names ), }; - if name != &self.target_id { + if name.node != self.target_id { return; } self.override_target_count = 1; @@ -258,7 +261,7 @@ impl<'ctx> MutSelfMutWalker<'ctx> for OverrideTransformer { if target.node.names.len() != 1 { continue; } - if target.node.names[0] != self.target_id { + if target.node.names[0].node != self.target_id { continue; } self.override_target_count += 1; @@ -397,7 +400,10 @@ impl OverrideTransformer { } else if let ast::OverrideAction::CreateOrUpdate = self.action { if !changed { let key = ast::Identifier { - names: parts.iter().map(|s| s.to_string()).collect(), + names: parts + .iter() + .map(|s| ast::Node::dummy_node(s.to_string())) + .collect(), ctx: ast::ExprContext::Store, pkgpath: "".to_string(), }; diff --git a/kclvm/query/src/tests.rs b/kclvm/query/src/tests.rs index 6758a23df..9ef9eb224 100644 --- a/kclvm/query/src/tests.rs +++ b/kclvm/query/src/tests.rs @@ -108,7 +108,7 @@ appConfiguration = AppConfiguration { labels: { key: { key: "override_value" - "str-key" = "override_value" + Node { node: "str-key", filename: "", line: 1, column: 1, end_line: 1, end_column: 1 } = "override_value" } } mainContainer: Main {name: "override_name"} diff --git a/kclvm/sema/src/pre_process/config.rs b/kclvm/sema/src/pre_process/config.rs index 9f8f9ea95..bff5e6ac9 100644 --- a/kclvm/sema/src/pre_process/config.rs +++ b/kclvm/sema/src/pre_process/config.rs @@ -114,7 +114,7 @@ impl ConfigMergeTransformer { ast::Stmt::Unification(unification_stmt) if !unification_stmt.target.node.names.is_empty() => { - let name = &unification_stmt.target.node.names[0]; + let name = &unification_stmt.target.node.names[0].node; match name_declaration_mapping.get_mut(name) { Some(declarations) => declarations.push(( module.filename.to_string(), @@ -139,7 +139,7 @@ impl ConfigMergeTransformer { if let ast::Expr::Schema(_) = assign_stmt.value.node { for target in &assign_stmt.targets { if target.node.names.len() == 1 { - let name = &target.node.names[0]; + let name = &target.node.names[0].node; match name_declaration_mapping.get_mut(name) { Some(declarations) => { // A hidden var is mutable. diff --git a/kclvm/sema/src/pre_process/identifier.rs b/kclvm/sema/src/pre_process/identifier.rs index 180627b31..9ac00c454 100644 --- a/kclvm/sema/src/pre_process/identifier.rs +++ b/kclvm/sema/src/pre_process/identifier.rs @@ -1,5 +1,6 @@ use crate::info::is_private_field; use indexmap::{IndexMap, IndexSet}; +use kclvm_ast::ast::Node; use kclvm_ast::pos::GetPos; use kclvm_ast::walker::MutSelfMutWalker; use kclvm_ast::{ast, walk_if_mut, walk_list_mut}; @@ -55,7 +56,7 @@ impl<'ctx> MutSelfMutWalker<'ctx> for QualifiedIdentifierTransformer { let is_config = matches!(assign_stmt.value.node, ast::Expr::Schema(_)); for target in &assign_stmt.targets { if !target.node.names.is_empty() { - let name = &target.node.names[0]; + let name = &target.node.names[0].node; if (is_private_field(name) || !self.global_names.contains_key(name) || is_config) && self.scope_level == 0 { @@ -70,7 +71,7 @@ impl<'ctx> MutSelfMutWalker<'ctx> for QualifiedIdentifierTransformer { if aug_assign_stmt.target.node.names.is_empty() { return; } - let name = &aug_assign_stmt.target.node.names[0]; + let name = &aug_assign_stmt.target.node.names[0].node; if is_private_field(name) || !self.global_names.contains_key(name) || is_config { if self.scope_level == 0 { self.global_names @@ -96,7 +97,8 @@ impl<'ctx> MutSelfMutWalker<'ctx> for QualifiedIdentifierTransformer { for gen in &mut list_comp.generators { for target in &gen.node.targets { if !target.node.names.is_empty() { - self.local_vars.insert(target.node.names[0].to_string()); + self.local_vars + .insert(target.node.names[0].node.to_string()); } } } @@ -108,7 +110,8 @@ impl<'ctx> MutSelfMutWalker<'ctx> for QualifiedIdentifierTransformer { for gen in &dict_comp.generators { for target in &gen.node.targets { if !target.node.names.is_empty() { - self.local_vars.insert(target.node.names[0].to_string()); + self.local_vars + .insert(target.node.names[0].node.to_string()); } } } @@ -122,7 +125,8 @@ impl<'ctx> MutSelfMutWalker<'ctx> for QualifiedIdentifierTransformer { fn walk_quant_expr(&mut self, quant_expr: &'ctx mut ast::QuantExpr) { for target in &quant_expr.variables { if !target.node.names.is_empty() { - self.local_vars.insert(target.node.names[0].to_string()); + self.local_vars + .insert(target.node.names[0].node.to_string()); } } self.walk_expr(&mut quant_expr.target.node); @@ -133,7 +137,7 @@ impl<'ctx> MutSelfMutWalker<'ctx> for QualifiedIdentifierTransformer { fn walk_identifier(&mut self, identifier: &'ctx mut ast::Identifier) { if identifier.names.len() >= 2 { // skip global name and generator local variables in list/dict comp and quant expression - let name = &identifier.names[0]; + let name = &identifier.names[0].node; if !self.global_names.contains_key(name) && !self.local_vars.contains(name) { if let Some(pkgpath) = self.import_names.get(name) { identifier.pkgpath = pkgpath.clone() @@ -159,8 +163,8 @@ impl<'ctx> MutSelfMutWalker<'ctx> for RawIdentifierTransformer { identifier.names = identifier .names .iter() - .map(|n| remove_raw_ident_prefix(n)) - .collect::>(); + .map(|name| Node::node_with_pos(remove_raw_ident_prefix(&name.node), name.pos())) + .collect::>>(); } fn walk_schema_attr(&mut self, schema_attr: &'ctx mut ast::SchemaAttr) { schema_attr.name.node = remove_raw_ident_prefix(&schema_attr.name.node); diff --git a/kclvm/sema/src/pre_process/tests.rs b/kclvm/sema/src/pre_process/tests.rs index b03cfc11f..6c23e50ec 100644 --- a/kclvm/sema/src/pre_process/tests.rs +++ b/kclvm/sema/src/pre_process/tests.rs @@ -25,13 +25,13 @@ fn test_fix_qualified_identifier() { fn test_fix_raw_identifier_prefix() { let mut module = parse_file("./src/pre_process/test_data/raw_identifier.k", None).unwrap(); if let ast::Stmt::Assign(assign_stmt) = &module.body[0].node { - assert_eq!(assign_stmt.targets[0].node.names[0], "$schema") + assert_eq!(assign_stmt.targets[0].node.names[0].node, "$schema") } else { panic!("invalid assign statement") } fix_raw_identifier_prefix(&mut module); if let ast::Stmt::Assign(assign_stmt) = &module.body[0].node { - assert_eq!(assign_stmt.targets[0].node.names[0], "schema") + assert_eq!(assign_stmt.targets[0].node.names[0].node, "schema") } else { panic!("invalid assign statement") } diff --git a/kclvm/sema/src/resolver/arg.rs b/kclvm/sema/src/resolver/arg.rs index 862807a7a..423c027f3 100644 --- a/kclvm/sema/src/resolver/arg.rs +++ b/kclvm/sema/src/resolver/arg.rs @@ -37,7 +37,7 @@ impl<'ctx> Resolver<'ctx> { let mut check_table: IndexSet = IndexSet::default(); for kw in kwargs { if !kw.node.arg.node.names.is_empty() { - let arg_name = &kw.node.arg.node.names[0]; + let arg_name = &kw.node.arg.node.names[0].node; if check_table.contains(arg_name) { self.handler.add_compile_error( &format!("{} has duplicated keyword argument {}", func_name, arg_name), diff --git a/kclvm/sema/src/resolver/config.rs b/kclvm/sema/src/resolver/config.rs index c1f900325..902eb4a47 100644 --- a/kclvm/sema/src/resolver/config.rs +++ b/kclvm/sema/src/resolver/config.rs @@ -124,12 +124,12 @@ impl<'ctx> Resolver<'ctx> { match key { Some(key) => { let names: Vec = match &key.node { - ast::Expr::Identifier(identifier) => identifier.names.clone(), + ast::Expr::Identifier(identifier) => identifier.get_names(), ast::Expr::Subscript(subscript) => { if let ast::Expr::Identifier(identifier) = &subscript.value.node { if let Some(index) = &subscript.index { if matches!(index.node, ast::Expr::NumberLit(_)) { - identifier.names.clone() + identifier.get_names() } else { return SwitchConfigContextState::KeepConfigUnchanged as usize; } @@ -267,13 +267,13 @@ impl<'ctx> Resolver<'ctx> { if let Some(Some(_)) = self.ctx.config_expr_context.last() { let mut has_index = false; let names: Vec = match &key.node { - ast::Expr::Identifier(identifier) => identifier.names.clone(), + ast::Expr::Identifier(identifier) => identifier.get_names(), ast::Expr::Subscript(subscript) => { if let ast::Expr::Identifier(identifier) = &subscript.value.node { if let Some(index) = &subscript.index { if matches!(index.node, ast::Expr::NumberLit(_)) { has_index = true; - identifier.names.clone() + identifier.get_names() } else { return; } @@ -406,7 +406,7 @@ impl<'ctx> Resolver<'ctx> { val_ty = Type::dict_ref(self.str_ty(), val_ty.clone()); } let key_ty = if identifier.names.len() == 1 { - let name = &identifier.names[0]; + let name = &identifier.names[0].node; let key_ty = if self.ctx.local_vars.contains(name) { self.expr(key) } else { diff --git a/kclvm/sema/src/resolver/global.rs b/kclvm/sema/src/resolver/global.rs index d873e99f8..319270000 100644 --- a/kclvm/sema/src/resolver/global.rs +++ b/kclvm/sema/src/resolver/global.rs @@ -220,7 +220,7 @@ impl<'ctx> Resolver<'ctx> { .add_compile_error("missing target in the assign statement", target.get_pos()); continue; } - let name = &target.node.names[0]; + let name = &target.node.names[0].node; let (start, end) = target.get_span_pos(); if self.contains_object(name) && !is_private_field(name) && unique_check { self.handler.add_error( @@ -315,7 +315,7 @@ impl<'ctx> Resolver<'ctx> { if target.node.names.is_empty() { return; } - let name = &target.node.names[0]; + let name = &target.node.names[0].node; let (start, end) = target.get_span_pos(); if self.contains_object(name) && !is_private_field(name) && unique_check { self.handler.add_error( @@ -683,7 +683,7 @@ impl<'ctx> Resolver<'ctx> { // Mixin types let mut mixin_types: Vec = vec![]; for mixin in &schema_stmt.mixins { - let mixin_names = &mixin.node.names; + let mixin_names = &mixin.node.get_names(); if !mixin_names[mixin_names.len() - 1].ends_with(MIXIN_SUFFIX) { self.handler.add_error( ErrorKind::NameError, diff --git a/kclvm/sema/src/resolver/node.rs b/kclvm/sema/src/resolver/node.rs index c6083e8eb..e0657fe21 100644 --- a/kclvm/sema/src/resolver/node.rs +++ b/kclvm/sema/src/resolver/node.rs @@ -63,7 +63,8 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Resolver<'ctx> { self.ctx.l_value = true; let expected_ty = self.walk_identifier_expr(&unification_stmt.target); self.ctx.l_value = false; - let obj = self.new_config_expr_context_item(&names[0], expected_ty.clone(), start, end); + let obj = + self.new_config_expr_context_item(&names[0].node, expected_ty.clone(), start, end); let init_stack_depth = self.switch_config_expr_context(Some(obj)); let ty = self.walk_schema_expr(&unification_stmt.value.node); self.clear_config_expr_context(init_stack_depth as usize, false); @@ -74,7 +75,7 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Resolver<'ctx> { None, ); if !ty.is_any() && expected_ty.is_any() { - self.set_type_to_scope(&names[0], ty, unification_stmt.target.get_pos()); + self.set_type_to_scope(&names[0].node, ty, unification_stmt.target.get_pos()); } expected_ty } @@ -132,7 +133,7 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Resolver<'ctx> { if target.node.names.is_empty() { continue; } - let name = &target.node.names[0]; + let name = &target.node.names[0].node; // Add global names. if (is_private_field(name) || is_config || !self.contains_global_name(name)) && self.scope_level == 0 @@ -191,7 +192,7 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Resolver<'ctx> { self.ctx.l_value = false; if !aug_assign_stmt.target.node.names.is_empty() { let is_config = matches!(aug_assign_stmt.value.node, ast::Expr::Schema(_)); - let name = &aug_assign_stmt.target.node.names[0]; + let name = &aug_assign_stmt.target.node.names[0].node; // Add global names. if is_private_field(name) || is_config || !self.contains_global_name(name) { if self.scope_level == 0 { @@ -286,7 +287,7 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Resolver<'ctx> { ); } target_node = Some(target); - let name = &target.node.names[0]; + let name = &target.node.names[0].node; if i == 0 { key_name = Some(name.to_string()); } else if i == 1 { @@ -464,7 +465,7 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Resolver<'ctx> { ); } for name in &selector_expr.attr.node.names { - value_ty = self.load_attr(value_ty.clone(), name, pos.clone()); + value_ty = self.load_attr(value_ty.clone(), &name.node, pos.clone()); } value_ty } @@ -734,7 +735,7 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Resolver<'ctx> { ); } target_node = Some(target); - let name = &target.node.names[0]; + let name = &target.node.names[0].node; if i == 0 { key_name = Some(name.to_string()); } else if i == 1 { @@ -962,7 +963,7 @@ impl<'ctx> MutSelfTypedResultWalker<'ctx> for Resolver<'ctx> { fn walk_identifier(&mut self, identifier: &'ctx ast::Identifier) -> Self::Result { self.resolve_var( - &identifier.names, + &identifier.get_names(), &identifier.pkgpath, self.ctx.start_pos.clone(), ) @@ -1091,7 +1092,7 @@ impl<'ctx> Resolver<'ctx> { identifier: &'ctx ast::NodeRef, ) -> ResolvedResult { self.resolve_var( - &identifier.node.names, + &identifier.node.get_names(), &identifier.node.pkgpath, identifier.get_pos(), ) diff --git a/kclvm/sema/src/resolver/schema.rs b/kclvm/sema/src/resolver/schema.rs index 26748162b..5f3ebcb7f 100644 --- a/kclvm/sema/src/resolver/schema.rs +++ b/kclvm/sema/src/resolver/schema.rs @@ -165,7 +165,7 @@ impl<'ctx> Resolver<'ctx> { for decorator in decorators { let name = if let ast::Expr::Identifier(identifier) = &decorator.node.func.node { if identifier.names.len() == 1 { - Some(identifier.names[0].clone()) + Some(identifier.names[0].node.clone()) } else { None } diff --git a/kclvm/sema/src/resolver/tests.rs b/kclvm/sema/src/resolver/tests.rs index ea21a9907..64dab670f 100644 --- a/kclvm/sema/src/resolver/tests.rs +++ b/kclvm/sema/src/resolver/tests.rs @@ -63,7 +63,7 @@ fn test_pkg_init_in_schema_resolve() { if let ast::Stmt::SchemaAttr(attr) = &schema.body[0].node { let value = attr.value.as_ref().unwrap(); if let ast::Expr::Schema(schema_expr) = &value.node { - assert_eq!(schema_expr.name.node.names, vec!["Name".to_string()]); + assert_eq!(schema_expr.name.node.get_names(), vec!["Name".to_string()]); } else { panic!("test failed, expect schema expr, got {:?}", value) } diff --git a/kclvm/sema/src/resolver/ty_alias.rs b/kclvm/sema/src/resolver/ty_alias.rs index d1a4887e5..04fd50f16 100644 --- a/kclvm/sema/src/resolver/ty_alias.rs +++ b/kclvm/sema/src/resolver/ty_alias.rs @@ -1,4 +1,5 @@ use indexmap::IndexMap; +use kclvm_ast::ast::Node; use kclvm_ast::walker::MutSelfMutWalker; use kclvm_ast::{ast, walk_if_mut, walk_list_mut}; @@ -98,11 +99,21 @@ impl<'ctx> MutSelfMutWalker<'ctx> for TypeAliasTransformer { // ``` if self.pkgpath != &pkgpath[1..] { identifier.pkgpath = pkgpath; - identifier.names = vec![splits[1].to_string(), splits[0].to_string()]; + identifier.names[0].node = splits[1].to_string(); + identifier.names[1].node = splits[0].to_string(); } } else { let names = type_alias.split('.').collect::>(); - identifier.names = names.iter().map(|n| n.to_string()).collect(); + let new_names: Vec> = names + .iter() + .zip(&identifier.names) + .map(|(name, pos_name)| { + let mut new_name = pos_name.clone(); + new_name.node = name.to_string(); + new_name.clone() + }) + .collect(); + identifier.names = new_names; } } } diff --git a/kclvm/tools/src/LSP/src/goto_def.rs b/kclvm/tools/src/LSP/src/goto_def.rs index 804449928..5225c362f 100644 --- a/kclvm/tools/src/LSP/src/goto_def.rs +++ b/kclvm/tools/src/LSP/src/goto_def.rs @@ -183,13 +183,13 @@ pub(crate) fn find_def_of_schema_attr( pub(crate) fn get_identifier_last_name(id: &Identifier) -> String { match id.names.len() { 0 => "".to_string(), - 1 => id.names[0].clone(), + 1 => id.names[0].node.clone(), _ => { - if id.names.last().unwrap().clone() == *"" { + if id.names.last().unwrap().node == *"" { // MissingExpr - id.names.get(id.names.len() - 2).unwrap().clone() + id.names.get(id.names.len() - 2).unwrap().node.clone() } else { - id.names.last().unwrap().clone() + id.names.last().unwrap().node.clone() } } } diff --git a/kclvm/tools/src/LSP/src/util.rs b/kclvm/tools/src/LSP/src/util.rs index 8769eec42..805538fe6 100644 --- a/kclvm/tools/src/LSP/src/util.rs +++ b/kclvm/tools/src/LSP/src/util.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use std::{fs, sync::Arc}; use indexmap::IndexSet; -use kclvm_ast::ast::{ConfigEntry, Expr, Identifier, Node, NodeRef, Program, Stmt, Type}; +use kclvm_ast::ast::{ConfigEntry, Expr, Identifier, Node, NodeRef, PosTuple, Program, Stmt, Type}; use kclvm_ast::pos::ContainsPos; use kclvm_config::modfile::KCL_FILE_EXTENSION; use kclvm_driver::kpm_metadata::fetch_metadata; @@ -162,6 +162,19 @@ macro_rules! walk_list_if_contains { }; } +fn transfer_ident_names(names: Vec, pos: &PosTuple) -> Vec> { + let mut new_names = vec![]; + let mut col = pos.2; + for name in &names { + let mut name_pos = pos.clone(); + name_pos.2 = col; + name_pos.4 = col + name.len() as u64; + new_names.push(Node::node_with_pos(name.clone(), name_pos)); + col = col + name.len() as u64 + ".".len() as u64; + } + new_names +} + /// Recursively finds the inner most expr and its schema_def expr if in a schema expr(e.g., schema_attr and schema_expr) /// in a stmt according to the position. pub(crate) fn inner_most_expr_in_stmt( @@ -176,7 +189,16 @@ pub(crate) fn inner_most_expr_in_stmt( return ( Some(Node::node_with_pos( Expr::Identifier(Identifier { - names: vec![ty.node.clone()], + names: transfer_ident_names( + vec![ty.node.clone()], + &( + ty.filename.clone(), + ty.line, + ty.column, + ty.end_line, + ty.end_column, + ), + ), pkgpath: "".to_string(), ctx: kclvm_ast::ast::ExprContext::Load, }), @@ -257,7 +279,16 @@ pub(crate) fn inner_most_expr_in_stmt( walk_if_contains!( Node::node_with_pos( Expr::Identifier(Identifier { - names: vec![schema_stmt.name.node.clone()], + names: transfer_ident_names( + vec![schema_stmt.name.node.clone()], + &( + schema_stmt.name.filename.clone(), + schema_stmt.name.line, + schema_stmt.name.column, + schema_stmt.name.end_line, + schema_stmt.name.end_column, + ), + ), pkgpath: "".to_string(), ctx: kclvm_ast::ast::ExprContext::Load, }), @@ -522,7 +553,16 @@ fn inner_most_expr_in_config_entry( fn build_identifier_from_string(s: &NodeRef) -> Node { Node::node_with_pos( Expr::Identifier(Identifier { - names: vec![s.node.clone()], + names: transfer_ident_names( + vec![s.node.clone()], + &( + s.filename.clone(), + s.line, + s.column, + s.end_line, + s.end_column, + ), + ), pkgpath: "".to_string(), ctx: kclvm_ast::ast::ExprContext::Load, }), diff --git a/kclvm/tools/src/vet/expr_builder.rs b/kclvm/tools/src/vet/expr_builder.rs index 36b5bb654..fdba17ae8 100644 --- a/kclvm/tools/src/vet/expr_builder.rs +++ b/kclvm/tools/src/vet/expr_builder.rs @@ -161,7 +161,7 @@ impl ExprGenerator for ExprBuilder { match schema_name { Some(s_name) => { let iden = node_ref!(Identifier { - names: vec![s_name.to_string()], + names: vec![Node::dummy_node(s_name.to_string())], pkgpath: String::new(), ctx: ExprContext::Load }); @@ -289,7 +289,7 @@ impl ExprGenerator for ExprBuilder { match schema_name { Some(s_name) => { let iden = node_ref!(Identifier { - names: vec![s_name.to_string()], + names: vec![Node::dummy_node(s_name.to_string())], pkgpath: String::new(), ctx: ExprContext::Load }); diff --git a/kclvm/tools/src/vet/test_datas/json/complex.k.ast.json b/kclvm/tools/src/vet/test_datas/json/complex.k.ast.json index 0ee30c15f..15de9eeb2 100644 --- a/kclvm/tools/src/vet/test_datas/json/complex.k.ast.json +++ b/kclvm/tools/src/vet/test_datas/json/complex.k.ast.json @@ -426,7 +426,14 @@ "node": { "ctx": "Load", "names": [ - "complex" + { + "column": 1, + "end_column": 1, + "end_line": 1, + "filename": "", + "line": 1, + "node": "complex" + } ], "pkgpath": "" } diff --git a/kclvm/tools/src/vet/test_datas/json/list.k.ast.json b/kclvm/tools/src/vet/test_datas/json/list.k.ast.json index 1cc7c1d70..fe6633124 100644 --- a/kclvm/tools/src/vet/test_datas/json/list.k.ast.json +++ b/kclvm/tools/src/vet/test_datas/json/list.k.ast.json @@ -158,7 +158,14 @@ "node": { "ctx": "Load", "names": [ - "list" + { + "column": 1, + "end_column": 1, + "end_line": 1, + "filename": "", + "line": 1, + "node": "list" + } ], "pkgpath": "" } diff --git a/kclvm/tools/src/vet/test_datas/json/only_with_bool.ast.json b/kclvm/tools/src/vet/test_datas/json/only_with_bool.ast.json index de8499450..9cccdd6f3 100644 --- a/kclvm/tools/src/vet/test_datas/json/only_with_bool.ast.json +++ b/kclvm/tools/src/vet/test_datas/json/only_with_bool.ast.json @@ -67,7 +67,14 @@ "node": { "ctx": "Load", "names": [ - "only_with_bool" + { + "column": 1, + "end_column": 1, + "end_line": 1, + "filename": "", + "line": 1, + "node": "only_with_bool" + } ], "pkgpath": "" } diff --git a/kclvm/tools/src/vet/test_datas/json/only_with_float.ast.json b/kclvm/tools/src/vet/test_datas/json/only_with_float.ast.json index 9726b82d5..df6282316 100644 --- a/kclvm/tools/src/vet/test_datas/json/only_with_float.ast.json +++ b/kclvm/tools/src/vet/test_datas/json/only_with_float.ast.json @@ -70,7 +70,14 @@ "node": { "ctx": "Load", "names": [ - "only_with_float" + { + "column": 1, + "end_column": 1, + "end_line": 1, + "filename": "", + "line": 1, + "node": "only_with_float" + } ], "pkgpath": "" } diff --git a/kclvm/tools/src/vet/test_datas/json/only_with_null.ast.json b/kclvm/tools/src/vet/test_datas/json/only_with_null.ast.json index e1f07e137..a06882e3b 100644 --- a/kclvm/tools/src/vet/test_datas/json/only_with_null.ast.json +++ b/kclvm/tools/src/vet/test_datas/json/only_with_null.ast.json @@ -67,7 +67,14 @@ "node": { "ctx": "Load", "names": [ - "only_with_null" + { + "column": 1, + "end_column": 1, + "end_line": 1, + "filename": "", + "line": 1, + "node": "only_with_null" + } ], "pkgpath": "" } diff --git a/kclvm/tools/src/vet/test_datas/json/simple.k.ast.json b/kclvm/tools/src/vet/test_datas/json/simple.k.ast.json index 5c2864b12..de6883e4d 100644 --- a/kclvm/tools/src/vet/test_datas/json/simple.k.ast.json +++ b/kclvm/tools/src/vet/test_datas/json/simple.k.ast.json @@ -148,7 +148,14 @@ "node": { "ctx": "Load", "names": [ - "simple" + { + "column": 1, + "end_column": 1, + "end_line": 1, + "filename": "", + "line": 1, + "node": "simple" + } ], "pkgpath": "" } diff --git a/kclvm/tools/src/vet/test_datas/json/test.k.ast.json b/kclvm/tools/src/vet/test_datas/json/test.k.ast.json index 954c074cc..53c91b362 100644 --- a/kclvm/tools/src/vet/test_datas/json/test.k.ast.json +++ b/kclvm/tools/src/vet/test_datas/json/test.k.ast.json @@ -292,7 +292,14 @@ "node": { "ctx": "Load", "names": [ - "test" + { + "column": 1, + "end_column": 1, + "end_line": 1, + "filename": "", + "line": 1, + "node": "test" + } ], "pkgpath": "" } diff --git a/kclvm/tools/src/vet/test_datas/yaml/complex.k.ast.yaml b/kclvm/tools/src/vet/test_datas/yaml/complex.k.ast.yaml index 0d7c301a6..ca97569d1 100644 --- a/kclvm/tools/src/vet/test_datas/yaml/complex.k.ast.yaml +++ b/kclvm/tools/src/vet/test_datas/yaml/complex.k.ast.yaml @@ -2,7 +2,12 @@ node: !Schema name: node: names: - - complex + - node: complex + filename: '' + line: 1 + column: 1 + end_line: 1 + end_column: 1 pkgpath: '' ctx: Load filename: '' diff --git a/kclvm/tools/src/vet/test_datas/yaml/list.k.ast.yaml b/kclvm/tools/src/vet/test_datas/yaml/list.k.ast.yaml index 91d0580bd..86281a922 100644 --- a/kclvm/tools/src/vet/test_datas/yaml/list.k.ast.yaml +++ b/kclvm/tools/src/vet/test_datas/yaml/list.k.ast.yaml @@ -4,7 +4,12 @@ node: !List name: node: names: - - list + - node: list + filename: '' + line: 1 + column: 1 + end_line: 1 + end_column: 1 pkgpath: '' ctx: Load filename: '' @@ -115,4 +120,4 @@ filename: '' line: 1 column: 1 end_line: 1 -end_column: 1 +end_column: 1 \ No newline at end of file diff --git a/kclvm/tools/src/vet/test_datas/yaml/only_with_bool.ast.yaml b/kclvm/tools/src/vet/test_datas/yaml/only_with_bool.ast.yaml index 642349be9..17c80b115 100644 --- a/kclvm/tools/src/vet/test_datas/yaml/only_with_bool.ast.yaml +++ b/kclvm/tools/src/vet/test_datas/yaml/only_with_bool.ast.yaml @@ -2,7 +2,12 @@ node: !Schema name: node: names: - - only_with_bool + - node: only_with_bool + filename: '' + line: 1 + column: 1 + end_line: 1 + end_column: 1 pkgpath: '' ctx: Load filename: '' diff --git a/kclvm/tools/src/vet/test_datas/yaml/only_with_float.ast.yaml b/kclvm/tools/src/vet/test_datas/yaml/only_with_float.ast.yaml index a38f830d8..838eae3cf 100644 --- a/kclvm/tools/src/vet/test_datas/yaml/only_with_float.ast.yaml +++ b/kclvm/tools/src/vet/test_datas/yaml/only_with_float.ast.yaml @@ -2,7 +2,12 @@ node: !Schema name: node: names: - - only_with_float + - node: only_with_float + filename: '' + line: 1 + column: 1 + end_line: 1 + end_column: 1 pkgpath: '' ctx: Load filename: '' @@ -51,4 +56,4 @@ filename: '' line: 1 column: 1 end_line: 1 -end_column: 1 +end_column: 1 \ No newline at end of file diff --git a/kclvm/tools/src/vet/test_datas/yaml/only_with_null.ast.yaml b/kclvm/tools/src/vet/test_datas/yaml/only_with_null.ast.yaml index babebbc5a..6264dc88b 100644 --- a/kclvm/tools/src/vet/test_datas/yaml/only_with_null.ast.yaml +++ b/kclvm/tools/src/vet/test_datas/yaml/only_with_null.ast.yaml @@ -2,7 +2,12 @@ node: !Schema name: node: names: - - only_with_null + - node: only_with_null + filename: '' + line: 1 + column: 1 + end_line: 1 + end_column: 1 pkgpath: '' ctx: Load filename: '' diff --git a/kclvm/tools/src/vet/test_datas/yaml/simple.k.ast.yaml b/kclvm/tools/src/vet/test_datas/yaml/simple.k.ast.yaml index 765e71e61..e484af4ef 100644 --- a/kclvm/tools/src/vet/test_datas/yaml/simple.k.ast.yaml +++ b/kclvm/tools/src/vet/test_datas/yaml/simple.k.ast.yaml @@ -2,7 +2,12 @@ node: !Schema name: node: names: - - simple + - node: simple + filename: '' + line: 1 + column: 1 + end_line: 1 + end_column: 1 pkgpath: '' ctx: Load filename: '' diff --git a/kclvm/tools/src/vet/test_datas/yaml/test.k.ast.yaml b/kclvm/tools/src/vet/test_datas/yaml/test.k.ast.yaml index cf7887e1b..49618bd07 100644 --- a/kclvm/tools/src/vet/test_datas/yaml/test.k.ast.yaml +++ b/kclvm/tools/src/vet/test_datas/yaml/test.k.ast.yaml @@ -2,7 +2,12 @@ node: !Schema name: node: names: - - test + - node: test + filename: '' + line: 1 + column: 1 + end_line: 1 + end_column: 1 pkgpath: '' ctx: Load filename: '' diff --git a/kclvm/tools/src/vet/validator.rs b/kclvm/tools/src/vet/validator.rs index 568b09a64..668b07ccf 100644 --- a/kclvm/tools/src/vet/validator.rs +++ b/kclvm/tools/src/vet/validator.rs @@ -202,7 +202,7 @@ pub fn validate(val_opt: ValidateOption) -> Result { fn build_assign(attr_name: &str, node: NodeRef) -> NodeRef { node_ref!(Stmt::Assign(AssignStmt { targets: vec![node_ref!(Identifier { - names: vec![attr_name.to_string()], + names: vec![Node::dummy_node(attr_name.to_string())], pkgpath: String::new(), ctx: ExprContext::Store, })],