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