Position injection

This commit is contained in:
2026-05-23 10:14:23 +02:00
parent b149bcde4a
commit fa00b3a199
2 changed files with 72 additions and 3 deletions
+7 -1
View File
@@ -3,7 +3,7 @@ use std::{
path::{Path, PathBuf},
};
use mist_parser::error::ParseError;
use mist_parser::{ast::TopLevel, error::ParseError};
pub fn build(root: &PathBuf) {
let src_dir = root.join("src");
@@ -144,6 +144,12 @@ pub fn transpile_file(path: &Path, output_path: &Path) -> Result<(), String> {
Ok(())
}
pub fn transpile_text<'a>(source: &'a str) -> Result<String, ParseError<'a, Vec<TopLevel>>> {
let mut gc = mist_codegen::RustCodegen::new();
Ok(gc.generate(mist_parser::parse(&source)?))
}
fn should_skip(source: &Path, output: &Path) -> bool {
if let (Ok(src_meta), Ok(out_meta)) = (fs::metadata(source), fs::metadata(output)) {
if let (Ok(src_time), Ok(out_time)) = (src_meta.modified(), out_meta.modified()) {