Lines Matching refs:content
454 optionally for a specific content.
466 content = None # Optional content matching pattern
475 args = [type_repr(self.type), self.content, self.name]
501 if self.content is not None:
536 def __init__(self, type=None, content=None, name=None):
538 Initializer. Takes optional type, content, and name.
541 this matches any *leaf* node; the content may still be required.
543 The content, if given, must be a string.
550 if content is not None:
551 assert isinstance(content, basestring), repr(content)
553 self.content = content
564 Match the pattern's content to the node's children.
566 This assumes the node type matches and self.content is not None.
575 return self.content == node.value
582 def __init__(self, type=None, content=None, name=None):
584 Initializer. Takes optional type, content, and name.
588 except if content is not None, in which it only matches
589 non-leaf nodes that also match the content pattern.
591 The content, if not None, must be a sequence of Patterns that
592 must match the node's children exactly. If the content is
600 if content is not None:
601 assert not isinstance(content, basestring), repr(content)
602 content = list(content)
603 for i, item in enumerate(content):
608 self.content = content
613 Match the pattern's content to the node's children.
615 This assumes the node type matches and self.content is not None.
625 for c, r in generate_matches(self.content, node.children):
631 if len(self.content) != len(node.children):
633 for subpattern, child in zip(self.content, node.children):
653 def __init__(self, content=None, min=0, max=HUGE, name=None):
658 content: optional sequence of subsequences of patterns;
665 [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is
666 equivalent to (a b c | d e | f g h); if content is None,
673 If content is not None, replace the dot with the parenthesized
677 if content is not None:
678 content = tuple(map(tuple, content)) # Protect against alterations
680 assert len(content), repr(content) # Can't have zero alternatives
681 for alt in content:
683 self.content = content
691 if (self.content is not None and
692 len(self.content) == 1 and len(self.content[0]) == 1):
693 subpattern = self.content[0][0]
695 if self.content is None:
701 return WildcardPattern(subpattern.content,
734 if self.content is None:
774 # generate matches that use just one alt from self.content
775 for alt in self.content:
786 for alt in self.content:
804 for leaf in self.content:
814 assert self.content is not None
818 for alt in self.content:
829 def __init__(self, content=None):
838 if content is not None:
839 assert isinstance(content, BasePattern), repr(content)
840 self.content = content
851 if self.content is None:
857 for c, r in self.content.generate_matches(nodes):