Class: RegularExpression::AST::Group
- Inherits:
-
Object
- Object
- RegularExpression::AST::Group
- Defined in:
- lib/regular_expression/ast.rb
Instance Attribute Summary collapse
- #expressions ⇒ Object readonly
-
#quantifier ⇒ Object
readonly
Quantifier.
Instance Method Summary collapse
-
#initialize(expressions, quantifier: Quantifier::Once.new) ⇒ Group
constructor
A new instance of Group.
- #to_dot(parent) ⇒ Object
- #to_nfa(start, finish) ⇒ Object
Constructor Details
#initialize(expressions, quantifier: Quantifier::Once.new) ⇒ Group
Returns a new instance of Group.
75 76 77 78 |
# File 'lib/regular_expression/ast.rb', line 75 def initialize(expressions, quantifier: Quantifier::Once.new) @expressions = expressions @quantifier = quantifier end |
Instance Attribute Details
#expressions ⇒ Object (readonly)
72 73 74 |
# File 'lib/regular_expression/ast.rb', line 72 def expressions @expressions end |
#quantifier ⇒ Object (readonly)
Quantifier
73 74 75 |
# File 'lib/regular_expression/ast.rb', line 73 def quantifier @quantifier end |
Instance Method Details
#to_dot(parent) ⇒ Object
80 81 82 83 84 85 |
# File 'lib/regular_expression/ast.rb', line 80 def to_dot(parent) node = parent.add_node(object_id, label: "Group") expressions.each { |expression| expression.to_dot(node) } quantifier.to_dot(node) end |
#to_nfa(start, finish) ⇒ Object
87 88 89 90 91 |
# File 'lib/regular_expression/ast.rb', line 87 def to_nfa(start, finish) quantifier.quantify(start, finish) do |qstart, qfinish| expressions.each { |expression| expression.to_nfa(qstart, qfinish) } end end |