Skip to content

Commit 7bccbe8

Browse files
committed
fix: adjusted to match correct data structure
1 parent 2e2127a commit 7bccbe8

File tree

6 files changed

+4394
-389
lines changed

6 files changed

+4394
-389
lines changed

build.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ fn runtime_function_parameter_to_token(
117117
let documentation = translation_to_token(param.documentation);
118118

119119
let quote = quote! {
120+
/*
120121
tucana::shared::RuntimeParameterDefinition {
121122
runtime_name: String::from(#runtime_name),
122123
data_type_identifier: String::from(#data_type_identifier),
@@ -125,6 +126,7 @@ fn runtime_function_parameter_to_token(
125126
description: vec![#(#description),*],
126127
documentation: vec![#(#documentation),*]
127128
}
129+
*/
128130
};
129131

130132
result.push(quote);
@@ -137,7 +139,7 @@ fn runtime_function_definition_to_token(definition: RuntimeFunctionDefinition) -
137139
let runtime_parameter_definitions =
138140
runtime_function_parameter_to_token(definition.runtime_parameter_definitions);
139141

140-
let return_type_identifier = definition.return_type_identifier.into_token_stream();
142+
// let return_type_identifier = definition.return_type_identifier.into_token_stream();
141143

142144
let error_type_identifiers = definition
143145
.error_type_identifiers
@@ -159,7 +161,7 @@ fn runtime_function_definition_to_token(definition: RuntimeFunctionDefinition) -
159161
tucana::shared::RuntimeFunctionDefinition {
160162
runtime_name: String::from(#runtime_name),
161163
runtime_parameter_definitions: vec![#(#runtime_parameter_definitions),*],
162-
return_type_identifier: Option::Some(String::from(#return_type_identifier)),
164+
// return_type_identifier: Option::Some(String::from(#return_type_identifier)),
163165
error_type_identifiers: vec![#(#error_type_identifiers),*],
164166
name: vec![#(#name),*],
165167
description: vec![#(#description),*],
@@ -169,9 +171,9 @@ fn runtime_function_definition_to_token(definition: RuntimeFunctionDefinition) -
169171
}
170172
}
171173
fn main() {
172-
let mut file = File::create("./out/output.rs").expect("msg");
174+
// let mut file = File::create("./out/output.rs").expect("msg");
173175

174-
let path = "./definitions/runtime_functions/primitive/boolean.md";
176+
let path = "./definitions/runtime_functions/array/array.md";
175177
let file_content = read_to_string(path).unwrap();
176178
let mut lines = file_content.split("\n");
177179
let mut inside_code_block = false;
@@ -198,9 +200,20 @@ fn main() {
198200
}
199201
}
200202

201-
let results = code_blocks
202-
.iter()
203-
.map(|f| serde_json::from_str::<RuntimeFunctionDefinition>(f));
203+
for code in code_blocks {
204+
match serde_json::from_str::<RuntimeFunctionDefinition>(&code) {
205+
Ok(def) => {
206+
// let quote = runtime_function_definition_to_token(def);
207+
// write!(file, "{},", quote).expect("Cannot write to file");
208+
}
209+
Err(err) => {
210+
print_on_build!("Error parsing JSON: {:?}", err);
211+
print_on_build!("JSON: {:?}", code);
212+
}
213+
}
214+
}
215+
216+
/*
204217
write!(
205218
file,
206219
"pub mod output {{ fn getDefinitions() -> Vec<tucana::shared::RuntimeFunctionDefinition> {{ vec!["
@@ -225,4 +238,5 @@ fn main() {
225238
.arg("./out/output.rs")
226239
.arg("--edition")
227240
.arg("2024");
241+
*/
228242
}

0 commit comments

Comments
 (0)