class RegularExpression::AST::Expression
Attributes
items[R]
Public Class Methods
new(items)
click to toggle source
# File lib/regular_expression/ast.rb, line 51 def initialize(items) @items = items end
Public Instance Methods
to_dot(parent)
click to toggle source
# File lib/regular_expression/ast.rb, line 55 def to_dot(parent) node = parent.add_node(object_id, label: "Expression") items.each { |item| item.to_dot(node) } end
to_nfa(start, finish)
click to toggle source
# File lib/regular_expression/ast.rb, line 61 def to_nfa(start, finish) inner = Array.new(items.length - 1) { NFA::State.new } states = [start, *inner, finish] items.each_with_index do |item, index| item.to_nfa(states[index], states[index + 1]) end end