| 166 | /// synthesizer keeps its JS sweep. |
| 167 | #[napi] |
| 168 | pub fn cfnptr_scan_files(files: Vec<CfnptrFileIn>) -> Vec<CfnptrFacts> { |
| 169 | files |
| 170 | .into_iter() |
| 171 | .map(|f| { |
| 172 | let structs: Vec<cfnptr::StructExtent> = f |
| 173 | .structs |
| 174 | .into_iter() |
| 175 | .map(|s| cfnptr::StructExtent { id: s.id, start_line: s.start_line, end_line: s.end_line }) |
| 176 | .collect(); |
| 177 | let facts = cfnptr::scan_file(&f.text, &structs); |
| 178 | CfnptrFacts { |
| 179 | fn_ptr_typedefs: facts.fn_ptr_typedefs, |
| 180 | fn_type_typedefs: facts.fn_type_typedefs, |
| 181 | structs: facts |
| 182 | .structs |
| 183 | .into_iter() |
| 184 | .map(|s| CfnptrStructOut { |
| 185 | id: s.id, |
| 186 | parsed: s.parsed, |
| 187 | fields: s |
| 188 | .fields |
| 189 | .into_iter() |
| 190 | .map(|fl| CfnptrField { name: fl.name, index: fl.index, ptr: fl.ptr, ty: fl.ty }) |
| 191 | .collect(), |
| 192 | }) |
| 193 | .collect(), |
| 194 | inline_ptr: facts.inline_ptr, |
| 195 | inline_types: facts.inline_types, |
| 196 | inline_tags: facts.inline_tags, |
| 197 | init_tokens: facts.init_tokens, |
| 198 | array_elems: facts.array_elems, |
| 199 | alias_names: facts.alias_names, |
| 200 | d_pairs: facts.d_pairs, |
| 201 | dispatch_fields: facts.dispatch_fields, |
| 202 | array_dispatch_names: facts.array_dispatch_names, |
| 203 | includes: facts.includes, |
| 204 | } |
| 205 | }) |
| 206 | .collect() |
| 207 | } |
| 208 | |
| 209 | /// Debug/differential hook: the native `stripCommentsForRegex(text, 'c')`. |
| 210 | /// Exists so the strip differential oracle can pin the Rust stripper against |