Position injection
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user