diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-04-28 01:04:58 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-04-28 01:04:58 +0200 |
| commit | ab77d1bf51541b745388fce1df64f62fea664906 (patch) | |
| tree | f4db5cf948c7c09c913ea149b20f4f0f30be468b /src/common | |
| parent | 4a7b6a78eb3f3cdec003dfd6d0495c313eb4d925 (diff) | |
start working on the procedure overloading
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/ast.odin | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/ast.odin b/src/common/ast.odin index 27484c7..92a5769 100644 --- a/src/common/ast.odin +++ b/src/common/ast.odin @@ -4,6 +4,7 @@ import "core:odin/ast" import "core:log" import "core:mem" import "core:fmt" +import "core:strings" keyword_map: map[string]bool = { "int" = true, @@ -143,6 +144,24 @@ get_ast_node_string :: proc(node: ^ast.Node, src: []byte) -> string { return string(src[node.pos.offset:node.end.offset]); } +get_doc :: proc(comment: ^ast.Comment_Group, allocator: mem.Allocator) -> string { + + if comment != nil { + tmp: string; + + for doc in comment.list { + tmp = strings.concatenate({tmp, "\n", doc.text}, context.temp_allocator); + } + + if tmp != "" { + replaced, allocated := strings.replace_all(tmp, "//", "", context.temp_allocator); + return strings.clone(replaced, allocator); + } + } + + return ""; +} + free_ast :: proc{ free_ast_node, free_ast_array, |