Struct regex_syntax::hir::translate::Translator
source · pub struct Translator {
stack: RefCell<Vec<HirFrame>>,
flags: Cell<Flags>,
utf8: bool,
line_terminator: u8,
}
Expand description
A translator maps abstract syntax to a high level intermediate representation.
A translator may be benefit from reuse. That is, a translator can translate many abstract syntax trees.
A Translator
can be configured in more detail via a
TranslatorBuilder
.
Fields§
§stack: RefCell<Vec<HirFrame>>
Our call stack, but on the heap.
flags: Cell<Flags>
The current flag settings.
utf8: bool
Whether we’re allowed to produce HIR that can match arbitrary bytes.
line_terminator: u8
The line terminator to use for .
.
Implementations§
source§impl Translator
impl Translator
sourcepub fn new() -> Translator
pub fn new() -> Translator
Create a new translator using the default configuration.
sourcepub fn translate(&mut self, pattern: &str, ast: &Ast) -> Result<Hir, Error>
pub fn translate(&mut self, pattern: &str, ast: &Ast) -> Result<Hir, Error>
Translate the given abstract syntax tree (AST) into a high level intermediate representation (HIR).
If there was a problem doing the translation, then an HIR-specific error is returned.
The original pattern string used to produce the Ast
must also be
provided. The translator does not use the pattern string during any
correct translation, but is used for error reporting.
Trait Implementations§
source§impl Clone for Translator
impl Clone for Translator
source§fn clone(&self) -> Translator
fn clone(&self) -> Translator
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl !Freeze for Translator
impl !RefUnwindSafe for Translator
impl Send for Translator
impl !Sync for Translator
impl Unpin for Translator
impl UnwindSafe for Translator
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)