Skip to content

Commit 0842bb6

Browse files
committed
lvl
1 parent c390d0c commit 0842bb6

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/cli.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use anyhow::{Ok, Result};
22
use clap::Parser;
33
use std::{fs::File, io::Write, path::PathBuf, str::FromStr};
4+
use svd_rs::ValidateLevel;
45

56
use svdtools::{
67
convert::convert_cli,
@@ -211,6 +212,7 @@ impl Command {
211212
expand: *expand,
212213
expand_properties: *expand_properties,
213214
ignore_enums: *ignore_enums,
215+
validate_level: ValidateLevel::Disabled,
214216
},
215217
format_config.as_ref().map(|p| p.as_path()),
216218
)?,
@@ -242,11 +244,9 @@ impl Command {
242244
input_format,
243245
out_path,
244246
} => {
245-
let device = convert_cli::open_svd(
246-
in_path,
247-
*input_format,
248-
convert_cli::ParserConfig::default(),
249-
)?;
247+
let mut cfg = convert_cli::ParserConfig::default();
248+
cfg.validate_level = ValidateLevel::Disabled;
249+
let device = convert_cli::open_svd(in_path, *input_format, cfg)?;
250250
let yml = enum_extract(&device);
251251
let mut out_str = String::new();
252252
let mut emitter = yaml_rust::YamlEmitter::new(&mut out_str);

src/convert/convert_cli.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anyhow::{anyhow, Result};
22
use std::io::{Read, Write};
33
use std::str::FromStr;
44
use std::{fs::File, path::Path};
5-
use svd_rs::Device;
5+
use svd_rs::{Device, ValidateLevel};
66

77
use crate::get_encoder_config;
88
pub use crate::ConfigFormat;
@@ -52,6 +52,7 @@ pub struct ParserConfig {
5252
pub expand: bool,
5353
pub expand_properties: bool,
5454
pub ignore_enums: bool,
55+
pub validate_level: ValidateLevel,
5556
}
5657

5758
pub fn open_svd(
@@ -73,7 +74,9 @@ pub fn open_svd(
7374
let mut device = match input_format {
7475
InputFormat::Xml => svd_parser::parse_with_config(
7576
&input,
76-
&svd_parser::Config::default().ignore_enums(parser_config.ignore_enums),
77+
&svd_parser::Config::default()
78+
.ignore_enums(parser_config.ignore_enums)
79+
.validate_level(parser_config.validate_level),
7780
)?,
7881
InputFormat::Yaml => serde_yaml::from_str(&input)?,
7982
InputFormat::Json => serde_json::from_str(&input)?,

0 commit comments

Comments
 (0)