Struct regex_syntax::hir::translate::TranslatorI [−][src]
struct TranslatorI<'t, 'p> {
trans: &'t Translator,
pattern: &'p str,
}The internal implementation of a translator.
This type is responsible for carrying around the original pattern string, which is not tied to the internal state of a translator.
A TranslatorI exists for the time it takes to translate a single Ast.
Fields
trans: &'t Translator
pattern: &'p str
Methods
impl<'t, 'p> TranslatorI<'t, 'p>[src]
impl<'t, 'p> TranslatorI<'t, 'p>fn new(trans: &'t Translator, pattern: &'p str) -> TranslatorI<'t, 'p>[src]
fn new(trans: &'t Translator, pattern: &'p str) -> TranslatorI<'t, 'p>Build a new internal translator.
fn trans(&self) -> &Translator[src]
fn trans(&self) -> &TranslatorReturn a reference to the underlying translator.
fn push(&self, frame: HirFrame)[src]
fn push(&self, frame: HirFrame)Push the given frame on to the call stack.
fn pop(&self) -> Option<HirFrame>[src]
fn pop(&self) -> Option<HirFrame>Pop the top of the call stack. If the call stack is empty, return None.
fn error(&self, span: Span, kind: ErrorKind) -> Error[src]
fn error(&self, span: Span, kind: ErrorKind) -> ErrorCreate a new error with the given span and error type.
fn flags(&self) -> Flags[src]
fn flags(&self) -> FlagsReturn a copy of the active flags.
fn set_flags(&self, ast_flags: &Flags) -> Flags[src]
fn set_flags(&self, ast_flags: &Flags) -> FlagsSet the flags of this translator from the flags set in the given AST. Then, return the old flags.
fn hir_literal(&self, lit: &Literal) -> Result<Hir, Error>[src]
fn hir_literal(&self, lit: &Literal) -> Result<Hir, Error>fn literal_to_char(&self, lit: &Literal) -> Result<Literal, Error>[src]
fn literal_to_char(&self, lit: &Literal) -> Result<Literal, Error>Convert an Ast literal to its scalar representation.
When Unicode mode is enabled, then this always succeeds and returns a
char (Unicode scalar value).
When Unicode mode is disabled, then a raw byte is returned. If that byte is not ASCII and invalid UTF-8 is not allowed, then this returns an error.
fn hir_from_char(&self, span: Span, c: char) -> Result<Hir, Error>[src]
fn hir_from_char(&self, span: Span, c: char) -> Result<Hir, Error>fn hir_from_char_case_insensitive(
&self,
span: Span,
c: char
) -> Result<Hir, Error>[src]
fn hir_from_char_case_insensitive(
&self,
span: Span,
c: char
) -> Result<Hir, Error>fn hir_dot(&self, span: Span) -> Result<Hir, Error>[src]
fn hir_dot(&self, span: Span) -> Result<Hir, Error>fn hir_assertion(&self, asst: &Assertion) -> Result<Hir, Error>[src]
fn hir_assertion(&self, asst: &Assertion) -> Result<Hir, Error>fn hir_group(&self, group: &Group, expr: Hir) -> Hir[src]
fn hir_group(&self, group: &Group, expr: Hir) -> Hirfn hir_repetition(&self, rep: &Repetition, expr: Hir) -> Hir[src]
fn hir_repetition(&self, rep: &Repetition, expr: Hir) -> Hirfn hir_unicode_class(
&self,
ast_class: &ClassUnicode
) -> Result<ClassUnicode, Error>[src]
fn hir_unicode_class(
&self,
ast_class: &ClassUnicode
) -> Result<ClassUnicode, Error>fn hir_perl_unicode_class(&self, ast_class: &ClassPerl) -> ClassUnicode[src]
fn hir_perl_unicode_class(&self, ast_class: &ClassPerl) -> ClassUnicodefn hir_perl_byte_class(&self, ast_class: &ClassPerl) -> ClassBytes[src]
fn hir_perl_byte_class(&self, ast_class: &ClassPerl) -> ClassBytesfn unicode_fold_and_negate(&self, negated: bool, class: &mut ClassUnicode)[src]
fn unicode_fold_and_negate(&self, negated: bool, class: &mut ClassUnicode)fn bytes_fold_and_negate(
&self,
span: &Span,
negated: bool,
class: &mut ClassBytes
) -> Result<(), Error>[src]
fn bytes_fold_and_negate(
&self,
span: &Span,
negated: bool,
class: &mut ClassBytes
) -> Result<(), Error>fn class_literal_byte(&self, ast: &Literal) -> Result<u8, Error>[src]
fn class_literal_byte(&self, ast: &Literal) -> Result<u8, Error>Return a scalar byte value suitable for use as a literal in a byte character class.
Trait Implementations
impl<'t, 'p> Visitor for TranslatorI<'t, 'p>[src]
impl<'t, 'p> Visitor for TranslatorI<'t, 'p>type Output = Hir
The result of visiting an AST.
type Err = Error
An error that visiting an AST might return.
fn finish(self) -> Result<Hir, Error>[src]
fn finish(self) -> Result<Hir, Error>All implementors of Visitor must provide a finish method, which yields the result of visiting the AST or an error. Read more
fn visit_pre(&mut self, ast: &Ast) -> Result<(), Error>[src]
fn visit_pre(&mut self, ast: &Ast) -> Result<(), Error>This method is called on an Ast before descending into child Ast nodes. Read more
fn visit_post(&mut self, ast: &Ast) -> Result<(), Error>[src]
fn visit_post(&mut self, ast: &Ast) -> Result<(), Error>This method is called on an Ast after descending all of its child Ast nodes. Read more
fn visit_class_set_item_pre(&mut self, ast: &ClassSetItem) -> Result<(), Error>[src]
fn visit_class_set_item_pre(&mut self, ast: &ClassSetItem) -> Result<(), Error>This method is called on every ClassSetItem before descending into child nodes. Read more
fn visit_class_set_item_post(&mut self, ast: &ClassSetItem) -> Result<(), Error>[src]
fn visit_class_set_item_post(&mut self, ast: &ClassSetItem) -> Result<(), Error>This method is called on every ClassSetItem after descending into child nodes. Read more
fn visit_class_set_binary_op_pre(
&mut self,
_op: &ClassSetBinaryOp
) -> Result<(), Error>[src]
fn visit_class_set_binary_op_pre(
&mut self,
_op: &ClassSetBinaryOp
) -> Result<(), Error>This method is called on every ClassSetBinaryOp before descending into child nodes. Read more
fn visit_class_set_binary_op_in(
&mut self,
_op: &ClassSetBinaryOp
) -> Result<(), Error>[src]
fn visit_class_set_binary_op_in(
&mut self,
_op: &ClassSetBinaryOp
) -> Result<(), Error>This method is called between the left hand and right hand child nodes of a ClassSetBinaryOp. Read more
fn visit_class_set_binary_op_post(
&mut self,
op: &ClassSetBinaryOp
) -> Result<(), Error>[src]
fn visit_class_set_binary_op_post(
&mut self,
op: &ClassSetBinaryOp
) -> Result<(), Error>This method is called on every ClassSetBinaryOp after descending into child nodes. Read more
fn start(&mut self)[src]
fn start(&mut self)This method is called before beginning traversal of the AST.
fn visit_alternation_in(&mut self) -> Result<(), Self::Err>[src]
fn visit_alternation_in(&mut self) -> Result<(), Self::Err>This method is called between child nodes of an Alternation. Read more
impl<'t, 'p> Clone for TranslatorI<'t, 'p>[src]
impl<'t, 'p> Clone for TranslatorI<'t, 'p>fn clone(&self) -> TranslatorI<'t, 'p>[src]
fn clone(&self) -> TranslatorI<'t, 'p>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<'t, 'p> Debug for TranslatorI<'t, 'p>[src]
impl<'t, 'p> Debug for TranslatorI<'t, 'p>Auto Trait Implementations
impl<'t, 'p> !Send for TranslatorI<'t, 'p>
impl<'t, 'p> !Send for TranslatorI<'t, 'p>impl<'t, 'p> !Sync for TranslatorI<'t, 'p>
impl<'t, 'p> !Sync for TranslatorI<'t, 'p>