Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
parsimonious.grammar.RuleVisitor Class Reference
Inheritance diagram for parsimonious.grammar.RuleVisitor:
Inheritance graph
[legend]
Collaboration diagram for parsimonious.grammar.RuleVisitor:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, custom_rules=None)
 
 visit_parenthesized (self, node, parenthesized)
 
 visit_quantifier (self, node, quantifier)
 
 visit_quantified (self, node, quantified)
 
 visit_lookahead_term (self, node, lookahead_term)
 
 visit_not_term (self, node, not_term)
 
 visit_rule (self, node, rule)
 
 visit_sequence (self, node, sequence)
 
 visit_ored (self, node, ored)
 
 visit_or_term (self, node, or_term)
 
 visit_label (self, node, label)
 
 visit_reference (self, node, reference)
 
 visit_regex (self, node, regex)
 
 visit_spaceless_literal (self, spaceless_literal, visited_children)
 
 visit_literal (self, node, literal)
 
 generic_visit (self, node, visited_children)
 
 visit_rules (self, node, rules_list)
 
- Public Member Functions inherited from parsimonious.nodes.NodeVisitor
 visit (self, node)
 
 parse (self, text, pos=0)
 
 match (self, text, pos=0)
 
 lift_child (self, node, children)
 
- Public Member Functions inherited from parsimonious.nodes.RuleDecoratorMeta
 __new__ (metaclass, name, bases, namespace)
 

Public Attributes

 custom_rules
 
- Public Attributes inherited from parsimonious.nodes.NodeVisitor
 unwrapped_exceptions
 

Static Public Attributes

dict quantifier_classes = {'?': Optional, '*': ZeroOrMore, '+': OneOrMore}
 
 visit_expression = NodeVisitor.lift_child
 
- Static Public Attributes inherited from parsimonious.nodes.NodeVisitor
 grammar = None
 
tuple unwrapped_exceptions = ()
 

Protected Attributes

 _last_literal_node_and_type
 

Additional Inherited Members

- Protected Member Functions inherited from parsimonious.nodes.NodeVisitor
 _parse_or_match (self, text, pos, method_name)
 

Detailed Description

Turns a parse tree of a grammar definition into a map of ``Expression``
objects

This is the magic piece that breathes life into a parsed bunch of parse
rules, allowing them to go forth and parse other things.

Constructor & Destructor Documentation

◆ __init__()

parsimonious.grammar.RuleVisitor.__init__ (   self,
  custom_rules = None 
)
Construct.

:arg custom_rules: A dict of {rule name: expression} holding custom
    rules which will take precedence over the others

Member Function Documentation

◆ generic_visit()

parsimonious.grammar.RuleVisitor.generic_visit (   self,
  node,
  visited_children 
)
Replace childbearing nodes with a list of their children; keep
others untouched.

For our case, if a node has children, only the children are important.
Otherwise, keep the node around for (for example) the flags of the
regex rule. Most of these kept-around nodes are subsequently thrown
away by the other visitor methods.

We can't simply hang the visited children off the original node; that
would be disastrous if the node occurred in more than one place in the
tree.

Reimplemented from parsimonious.nodes.NodeVisitor.

◆ visit_label()

parsimonious.grammar.RuleVisitor.visit_label (   self,
  node,
  label 
)
Turn a label into a unicode string.

◆ visit_literal()

parsimonious.grammar.RuleVisitor.visit_literal (   self,
  node,
  literal 
)
Pick just the literal out of a literal-and-junk combo.

◆ visit_or_term()

parsimonious.grammar.RuleVisitor.visit_or_term (   self,
  node,
  or_term 
)
Return just the term from an ``or_term``.

We already know it's going to be ored, from the containing ``ored``.

◆ visit_parenthesized()

parsimonious.grammar.RuleVisitor.visit_parenthesized (   self,
  node,
  parenthesized 
)
Treat a parenthesized subexpression as just its contents.

Its position in the tree suffices to maintain its grouping semantics.

◆ visit_quantifier()

parsimonious.grammar.RuleVisitor.visit_quantifier (   self,
  node,
  quantifier 
)
Turn a quantifier into just its symbol-matching node.

◆ visit_reference()

parsimonious.grammar.RuleVisitor.visit_reference (   self,
  node,
  reference 
)
Stick a :class:`LazyReference` in the tree as a placeholder.

We resolve them all later.

◆ visit_regex()

parsimonious.grammar.RuleVisitor.visit_regex (   self,
  node,
  regex 
)
Return a ``Regex`` expression.

Reimplemented in parsimonious.grammar.TokenRuleVisitor.

◆ visit_rule()

parsimonious.grammar.RuleVisitor.visit_rule (   self,
  node,
  rule 
)
Assign a name to the Expression and return it.

◆ visit_rules()

parsimonious.grammar.RuleVisitor.visit_rules (   self,
  node,
  rules_list 
)
Collate all the rules into a map. Return (map, default rule).

The default rule is the first one. Or, if you have more than one rule
of that name, it's the last-occurring rule of that name. (This lets you
override the default rule when you extend a grammar.) If there are no
string-based rules, the default rule is None, because the custom rules,
due to being kwarg-based, are unordered.

◆ visit_sequence()

parsimonious.grammar.RuleVisitor.visit_sequence (   self,
  node,
  sequence 
)
A parsed Sequence looks like [term node, OneOrMore node of
``another_term``s]. Flatten it out.

◆ visit_spaceless_literal()

parsimonious.grammar.RuleVisitor.visit_spaceless_literal (   self,
  spaceless_literal,
  visited_children 
)
Turn a string literal into a ``Literal`` that recognizes it.

Reimplemented in parsimonious.grammar.TokenRuleVisitor.


The documentation for this class was generated from the following file: