(&mut self, path: &Locations)
| 2070 | } |
| 2071 | |
| 2072 | fn read_patterns(&mut self, path: &Locations) -> Result<()> { |
| 2073 | if let Some(p) = &path[0] { |
| 2074 | // info!("Reading rule file: {}", p.to_str().unwrap()); |
| 2075 | let rule_file_contents = read_to_string_shim(p.as_path()).expect("cannot read file"); |
| 2076 | |
| 2077 | let rules_build_fn = |pattern: &Yaml| { |
| 2078 | self.build_speech_patterns(pattern, p) |
| 2079 | .chain_err(||format!("in file {:?}", p.to_str().unwrap())) |
| 2080 | }; |
| 2081 | return compile_rule(&rule_file_contents, rules_build_fn) |
| 2082 | .chain_err(||format!("in file {:?}", p.to_str().unwrap())); |
| 2083 | } |
| 2084 | return Ok(()); |
| 2085 | } |
| 2086 | |
| 2087 | fn build_speech_patterns(&mut self, patterns: &Yaml, file_name: &Path) -> Result<()> { |
| 2088 | // Rule::SpeechPatternList |
no test coverage detected