MCPcopy Create free account
hub / github.com/davidblewett/rure-python / into_ast

Method into_ast

regex/regex-syntax/src/ast/mod.rs:575–581  ·  view source on GitHub ↗

Return this alternation as an AST. If this alternation contains zero ASTs, then Ast::Empty is returned. If this alternation contains exactly 1 AST, then the corresponding AST is returned. Otherwise, Ast::Alternation is returned.

(mut self)

Source from the content-addressed store, hash-verified

573 /// returned. If this alternation contains exactly 1 AST, then the
574 /// corresponding AST is returned. Otherwise, Ast::Alternation is returned.
575 pub fn into_ast(mut self) -> Ast {
576 match self.asts.len() {
577 0 => Ast::Empty(self.span),
578 1 => self.asts.pop().unwrap(),
579 _ => Ast::Alternation(self),
580 }
581 }
582}
583
584/// A concatenation of regular expressions.

Callers

nothing calls this directly

Calls 5

AlternationClass · 0.85
ConcatClass · 0.85
unwrapMethod · 0.80
lenMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected