aboutsummaryrefslogtreecommitdiff
path: root/src/compiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler.c')
-rw-r--r--src/compiler.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler.c b/src/compiler.c
index 3ccb86a..dbc1498 100644
--- a/src/compiler.c
+++ b/src/compiler.c
@@ -482,3 +482,13 @@ int amal_compiler_internal_load_file(amal_compiler *self, const char *filepath,
return 0;
}
+
+Tokenizer* amal_compiler_find_tokenizer_by_code_reference(amal_compiler *self, const char *code_ref) {
+ Parser **parser = buffer_begin(&self->parsers);
+ Parser **parser_end = buffer_end(&self->parsers);
+ for(; parser != parser_end; ++parser) {
+ if(tokenizer_contains_code_reference(&(*parser)->tokenizer, code_ref))
+ return &(*parser)->tokenizer;
+ }
+ return NULL;
+}