-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flamingo: Start work on import statement
- Loading branch information
Showing
3 changed files
with
5,017 additions
and
1,017 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This Source Form is subject to the terms of the AQUA Software License, | ||
// v. 1.0. Copyright (c) 2024 Aymeric Wibo | ||
|
||
#include "common.h" | ||
#include "flamingo.h" | ||
#include "runtime/tree_sitter/api.h" | ||
|
||
#include <assert.h> | ||
#include <string.h> | ||
|
||
static int parse_import(flamingo_t* flamingo, TSNode node) { | ||
assert(strcmp(ts_node_type(node), "import") == 0); | ||
assert(ts_node_child_count(node) == 2); | ||
|
||
TSNode const relative_node = ts_node_child_by_field_name(node, "relative", 8); | ||
bool const is_relative = !ts_node_is_null(relative_node); | ||
|
||
TSNode const path_node = ts_node_child_by_field_name(node, "path", 4); | ||
char const* const path_type = ts_node_type(path_node); | ||
|
||
if (strcmp(path_type, "import_path") != 0) { | ||
return error(flamingo, "expected import_path for path, got %s", path_type); | ||
} | ||
|
||
// Parse the import path into an actual string path we can use. | ||
|
||
return error(flamingo, "TODO"); | ||
} |
Oops, something went wrong.