aboutsummaryrefslogtreecommitdiff
path: root/dev_tools/src/verify.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dev_tools/src/verify.rs')
-rw-r--r--dev_tools/src/verify.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/dev_tools/src/verify.rs b/dev_tools/src/verify.rs
index 834e408..2ddff0c 100644
--- a/dev_tools/src/verify.rs
+++ b/dev_tools/src/verify.rs
@@ -73,6 +73,24 @@ fn parse_single_block(lines: &[&str], start: usize, source_file: &str) -> Option
break;
}
+ // @@@ lines: strip the prefix and treat as regular Rust code
+ // These lines are hidden in the rendered docs (filtered by a docsify plugin)
+ // but must still compile.
+ if trimmed.starts_with("@@@") {
+ in_header = false;
+ // Strip @@@ and optionally one following space
+ let code = trimmed[3..].trim_start();
+ if code.contains("fn main") {
+ has_main = true;
+ }
+ if code.contains("gen_program!") {
+ has_gen_program = true;
+ }
+ code_lines.push(code.to_string());
+ idx += 1;
+ continue;
+ }
+
// Parse header comments
// Check for NOT VERIFIED marker
if in_header && trimmed == "// NOT VERIFIED" {
@@ -278,8 +296,8 @@ pub fn generate_main_rs(block: &CodeBlock) -> String {
pub fn generate_build_rs(block: &CodeBlock) -> String {
let mut output = String::from("#![allow(dead_code)]\n#![allow(unused)]\n");
- if !block.code.contains("use mingling::builds::*;") {
- output.push_str("#[allow(unused_imports)]\nuse mingling::builds::*;\n\n");
+ if !block.code.contains("use mingling::build::*;") {
+ output.push_str("#[allow(unused_imports)]\nuse mingling::build::*;\n\n");
}
if block.has_main {