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

Method induct_class

regex/regex-syntax/src/ast/visitor.rs:406–443  ·  view source on GitHub ↗

Build a stack frame for the given class node if one is needed (which occurs if and only if there are child nodes). Otherwise, return None.

(
        &self,
        ast: &ClassInduct<'a>,
    )

Source from the content-addressed store, hash-verified

404 /// Build a stack frame for the given class node if one is needed (which
405 /// occurs if and only if there are child nodes). Otherwise, return None.
406 fn induct_class(
407 &self,
408 ast: &ClassInduct<'a>,
409 ) -> Option<ClassFrame<'a>> {
410 match *ast {
411 ClassInduct::Item(&ast::ClassSetItem::Bracketed(ref x)) => {
412 match x.kind {
413 ast::ClassSet::Item(ref item) => {
414 Some(ClassFrame::Union {
415 head: item,
416 tail: &[],
417 })
418 }
419 ast::ClassSet::BinaryOp(ref op) => {
420 Some(ClassFrame::Binary { op: op })
421 }
422 }
423 }
424 ClassInduct::Item(&ast::ClassSetItem::Union(ref x)) => {
425 if x.items.is_empty() {
426 None
427 } else {
428 Some(ClassFrame::Union {
429 head: &x.items[0],
430 tail: &x.items[1..],
431 })
432 }
433 }
434 ClassInduct::BinaryOp(op) => {
435 Some(ClassFrame::BinaryLHS {
436 op: op,
437 lhs: &op.lhs,
438 rhs: &op.rhs,
439 })
440 }
441 _ => None,
442 }
443 }
444
445 /// Pops the given frame. If the frame has an additional inductive step,
446 /// then return it, otherwise return `None`.

Callers 1

visit_classMethod · 0.80

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected