mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-07 15:38:49 +00:00
statements builders start
This commit is contained in:
parent
0e6d4bd67f
commit
64a91299ff
3 changed files with 107 additions and 5 deletions
|
|
@ -495,7 +495,11 @@ build_name_expression(parser::ParseTree::Node parse_node,
|
|||
type_storage, arguments);
|
||||
|
||||
return nodes::NameExpression(
|
||||
build_node(parse_node), build_simple_name(name_node),
|
||||
build_node(parse_node),
|
||||
tokens::string_to_type(name_node.get_type()) ==
|
||||
tokens::Type::ARGUMENT_NAME_IDENTIFIER
|
||||
? build_argument_name(name_node)
|
||||
: build_simple_name(name_node),
|
||||
std::move(arguments),
|
||||
prefix_node.has_value() ? build_type(prefix_node.value(), type_storage)
|
||||
: std::optional<nodes::TypeProxy>(),
|
||||
|
|
@ -526,12 +530,15 @@ nodes::Lambda build_lambda(parser::ParseTree::Node parse_node,
|
|||
nodes::TypeStorage &type_storage) {
|
||||
std::vector<nodes::Identifier> arguments;
|
||||
|
||||
auto current_node = parse_node.nth_named_child(0);
|
||||
while (tokens::string_to_type(current_node.get_type()) ==
|
||||
tokens::Type::ARGUMENT_NAME_IDENTIFIER) {
|
||||
auto current_node = parse_node.nth_child(1); // next to '\\'
|
||||
|
||||
while (current_node.is_named()) { // until _do_
|
||||
arguments.emplace_back(build_argument_name(parse_node));
|
||||
current_node = current_node.next_named_sibling();
|
||||
current_node = current_node.next_sibling();
|
||||
}
|
||||
|
||||
current_node = current_node.next_named_sibling();
|
||||
|
||||
return nodes::Lambda(
|
||||
build_node(parse_node), std::move(arguments),
|
||||
build_expression(current_node, expression_storage, type_storage));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue