Fix code generator

This commit is contained in:
moznion
2020-11-29 01:21:19 +09:00
parent 83c39f7861
commit e426b8f935

View File

@@ -387,6 +387,7 @@ fn parse_dict_file(dict_file_path: &Path) -> Result<DictParsed, String> {
let line_filter_re = Regex::new(r"^(?:#.*|)$").unwrap();
let tabs_re = Regex::new(r"\t+").unwrap();
let trailing_comment_re = Regex::new(r"\s*?#.+?$").unwrap();
let spaces_re = Regex::new(r"\s+").unwrap();
let mut radius_attributes: Vec<RadiusAttribute> = Vec::new();
let mut radius_attribute_to_values: BTreeMap<String, Vec<RadiusValue>> = BTreeMap::new();
@@ -409,7 +410,7 @@ fn parse_dict_file(dict_file_path: &Path) -> Result<DictParsed, String> {
match kind {
ATTRIBUTE_KIND => {
let attribute_type_leaf = trailing_comment_re.replace(items[3], "").to_string();
let type_descriptions = attribute_type_leaf.split(' ').collect::<Vec<&str>>();
let type_descriptions: Vec<&str> = spaces_re.split(&attribute_type_leaf).collect();
let is_encrypt = if type_descriptions.len() >= 2 {
type_descriptions[1] == "encrypt=1" // FIXME: ad-hoc!!!