diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-01-10 14:06:38 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-01-10 14:06:38 +0100 |
| commit | 78749296776b2d9b7cb1d03b93c97ceb32c8c0b3 (patch) | |
| tree | 45b29dada0784b3b7c6264dae61169fe4ecaa84d /src/compiler.rs | |
| parent | de8108932c3ac9ef1ea70ea5b0c74f369c36c442 (diff) | |
| download | sylt-78749296776b2d9b7cb1d03b93c97ceb32c8c0b3.tar.gz | |
take Paths where files are needed
Diffstat (limited to 'src/compiler.rs')
| -rw-r--r-- | src/compiler.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler.rs b/src/compiler.rs index 7732992..218711c 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -1,3 +1,5 @@ +use std::path::Path; + use crate::tokenizer::{Token, TokenStream}; use crate::vm::{Value, Block, Op}; @@ -196,8 +198,8 @@ impl Compiler { } } - pub fn compile(&mut self, name: &str, filename: &str) -> Block { - let mut block = Block::new(name, filename); + pub fn compile(&mut self, name: &str, file: &Path) -> Block { + let mut block = Block::new(name, file); loop { if self.peek() == Token::EOF { @@ -217,6 +219,6 @@ impl Compiler { } } -pub fn compile(name: &str, filename: &str, tokens: TokenStream) -> Block { - Compiler::new(tokens).compile(name, filename) +pub fn compile(name: &str, file: &Path, tokens: TokenStream) -> Block { + Compiler::new(tokens).compile(name, file) } |
