Working pre-processing module name

This commit is contained in:
2026-06-13 19:06:34 +02:00
parent 5d3e393d5a
commit c8187379a5
4 changed files with 43 additions and 75 deletions
+4 -11
View File
@@ -3,10 +3,7 @@ use std::{
path::{Path, PathBuf},
};
use mist_parser::{
ast::{Identifier, TopLevel, Visibility},
error::ParseError,
};
use mist_parser::{ast::TopLevel, error::ParseError};
pub fn build(root: &PathBuf) {
let src_dir = root.join("src");
@@ -136,9 +133,7 @@ pub fn transpile_file(path: &Path, output_path: &Path) -> Result<(), String> {
});
// If parsing fails, return the error string back gracefully so the LSP can show it
let ast = parser_result
.map_err(|e| format!("parse failed in {}:\n{}", path.display(), e))?
.1;
let ast = parser_result.map_err(|e| format!("parse failed in {}:\n{}", path.display(), e))?;
let mut gc = mist_codegen::RustCodegen::new();
let output = gc.generate(ast);
@@ -149,12 +144,10 @@ pub fn transpile_file(path: &Path, output_path: &Path) -> Result<(), String> {
Ok(())
}
pub fn transpile_text<'a>(
source: &'a str,
) -> Result<String, ParseError<'a, (Option<(Visibility, Identifier)>, Vec<TopLevel>)>> {
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)?.1))
Ok(gc.generate(mist_parser::parse(&source)?))
}
fn should_skip(source: &Path, output: &Path) -> bool {