Lines Matching defs:Ast
443 pub ast: Ast,
463 /// An `Ast`'s `fmt::Display` implementation uses constant stack space and heap
464 /// space proportional to the size of the `Ast`.
467 /// heap space proportional to the size of the `Ast`.
469 pub enum Ast {
493 impl Ast {
497 Ast::Empty(ref span) => span,
498 Ast::Flags(ref x) => &x.span,
499 Ast::Literal(ref x) => &x.span,
500 Ast::Dot(ref span) => span,
501 Ast::Assertion(ref x) => &x.span,
502 Ast::Class(ref x) => x.span(),
503 Ast::Repetition(ref x) => &x.span,
504 Ast::Group(ref x) => &x.span,
505 Ast::Alternation(ref x) => &x.span,
506 Ast::Concat(ref x) => &x.span,
510 /// Return true if and only if this Ast is empty.
513 Ast::Empty(_) => true,
522 Ast::Empty(_)
523 | Ast::Flags(_)
524 | Ast::Literal(_)
525 | Ast::Dot(_)
526 | Ast::Assertion(_) => false,
527 Ast::Class(_)
528 | Ast::Repetition(_)
529 | Ast::Group(_)
530 | Ast::Alternation(_)
531 | Ast::Concat(_) => true,
536 /// Print a display representation of this Ast.
539 /// have originally been present in the concrete syntax from which this Ast
543 /// to the size of the `Ast`.
544 impl fmt::Display for Ast {
557 pub asts: Vec<Ast>,
563 /// If this alternation contains zero ASTs, then Ast::Empty is
565 /// corresponding AST is returned. Otherwise, Ast::Alternation is returned.
566 pub fn into_ast(mut self) -> Ast {
568 0 => Ast::Empty(self.span),
570 _ => Ast::Alternation(self),
581 pub asts: Vec<Ast>,
587 /// If this concatenation contains zero ASTs, then Ast::Empty is
589 /// corresponding AST is returned. Otherwise, Ast::Concat is returned.
590 pub fn into_ast(mut self) -> Ast {
592 0 => Ast::Empty(self.span),
594 _ => Ast::Concat(self),
1127 pub ast: Box<Ast>,
1190 pub ast: Box<Ast>,
1357 /// A custom `Drop` impl is used for `Ast` such that it uses constant stack
1358 /// space but heap space proportional to the depth of the `Ast`.
1359 impl Drop for Ast {
1364 Ast::Empty(_)
1365 | Ast::Flags(_)
1366 | Ast::Literal(_)
1367 | Ast::Dot(_)
1368 | Ast::Assertion(_)
1370 | Ast::Class(_) => return,
1371 Ast::Repetition(ref x) if !x.ast.has_subexprs() => return,
1372 Ast::Group(ref x) if !x.ast.has_subexprs() => return,
1373 Ast::Alternation(ref x) if x.asts.is_empty() => return,
1374 Ast::Concat(ref x) if x.asts.is_empty() => return,
1379 let empty_ast = || Ast::Empty(empty_span());
1383 Ast::Empty(_)
1384 | Ast::Flags(_)
1385 | Ast::Literal(_)
1386 | Ast::Dot(_)
1387 | Ast::Assertion(_)
1389 | Ast::Class(_) => {}
1390 Ast::Repetition(ref mut x) => {
1393 Ast::Group(ref mut x) => {
1396 Ast::Alternation(ref mut x) => {
1399 Ast::Concat(ref mut x) => {
1472 // for Ast can handle arbitrarily sized expressions in constant stack
1482 let mut ast = Ast::Empty(span());
1484 ast = Ast::Group(Group {