Class: RegularExpression::AST::Character

Inherits:
Object
  • Object
show all
Defined in:
lib/regular_expression/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Character

Returns a new instance of Character.



179
180
181
# File 'lib/regular_expression/ast.rb', line 179

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

String



177
178
179
# File 'lib/regular_expression/ast.rb', line 177

def value
  @value
end

Instance Method Details

#to_dot(parent) ⇒ Object



183
184
185
# File 'lib/regular_expression/ast.rb', line 183

def to_dot(parent)
  parent.add_node(object_id, label: value, shape: "box")
end

#to_nfa(start, finish) ⇒ Object



191
192
193
# File 'lib/regular_expression/ast.rb', line 191

def to_nfa(start, finish)
  start.add_transition(NFA::Transition::Value.new(finish, value))
end

#to_nfa_valuesObject



187
188
189
# File 'lib/regular_expression/ast.rb', line 187

def to_nfa_values
  [value]
end