[−][src]Struct gpp::Context
Context of the current processing.
Contains a set of currently defined macros, as well as the number of nested if statements that are being ignored; this is so that if the parser failed an if statement, and it is currently ignoring data, it knows how many endifs it needs to encounter before resuming reading data again. Only if this value is 0 then the parser will read data. It also stores whether the current if group has been accepted; this is for if groups with over three parts.
There are no limits on what variable names can be; by directly altering Context::macros, you can set variable names not possible with #defines. However, when replacing variable names in text the variable name must be surrounded by two characters that are not alphanumeric or an underscore.
Fields
macros: HashMap<String, String>
Map of all currently defined macros.
inactive_stack: u32
Number of layers of inactive if statements.
used_if: bool
Whether the current if statement has been accepted.
allow_exec: bool
Whether #exec and #in commands are allowed.
in_stack: Vec<Child>
The stack of processes that #in is piping to.
Methods
impl Context
[src]
pub fn new() -> Context
[src]
Create a new empty context with no macros or inactive stack and exec commands disallowed.
pub fn new_exec() -> Context
[src]
Create a new empty context with no macros or inactive stack and exec commands allowed.
pub fn from_map(macros: HashMap<String, String>) -> Context
[src]
Create a context from an existing HashMap
pub fn from_vec(macros: Vec<(&str, &str)>) -> Context
[src]
Create a context from a vector of tuples
Trait Implementations
Auto Trait Implementations
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
impl RefUnwindSafe for Context
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,