neutralts/bif/
parse_bif_else.rs1#![doc = include_str!("../../doc/bif-else.md")]
2
3use crate::{bif::constants::*, bif::Bif, bif::BifError, constants::*};
4
5impl<'a> Bif<'a> {
6 pub(crate) fn parse_bif_else(&mut self) -> Result<(), BifError> {
12 if self.mod_filter {
13 return Err(self.bif_error(BIF_ERROR_MODIFIER_NOT_ALLOWED));
14 }
15
16 self.extract_params_code(true);
17
18 if !self.flags.is_empty() {
19 return Err(self.bif_error(BIF_ERROR_FLAGS_NOT_ALLOWED));
20 }
21
22 if self.inherit.last_bif_out ^ self.mod_negate {
23 self.out = EMPTY_STRING;
24
25 return Ok(());
26 }
27
28 if self.code.contains(BIF_OPEN) {
29 self.code = new_child_parse!(self, &self.code, self.mod_scope);
30 }
31
32 self.out = self.code.to_string();
33
34 Ok(())
35 }
36}
37
38#[cfg(test)]
39#[path = "parse_bif_else_tests.rs"]
40mod tests;