Class: Dhaka::LexerSupport::CatNode

Inherits:
BinaryNode show all
Defined in:
lib/lexer/regex_grammar.rb

Direct Known Subclasses

LookaheadNode, RootNode

Instance Attribute Summary

Attributes inherited from BinaryNode

#left, #right

Instance Method Summary collapse

Methods inherited from BinaryNode

#initialize, #to_dot

Methods inherited from ASTNode

#accepting, #checkpoint

Constructor Details

This class inherits a constructor from Dhaka::LexerSupport::BinaryNode

Instance Method Details

#calculate_follow_setsObject



239
240
241
242
243
244
# File 'lib/lexer/regex_grammar.rb', line 239

def calculate_follow_sets
  super
  left.last.each do |leaf_node|
    leaf_node.follow_set.merge right.first
  end
end

#firstObject



231
232
233
# File 'lib/lexer/regex_grammar.rb', line 231

def first
  left.nullable ? (left.first | right.first) : left.first
end

#labelObject



223
224
225
# File 'lib/lexer/regex_grammar.rb', line 223

def label
  "cat"
end

#lastObject



235
236
237
# File 'lib/lexer/regex_grammar.rb', line 235

def last
  right.nullable ? (left.last | right.last) : right.last
end

#nullableObject



227
228
229
# File 'lib/lexer/regex_grammar.rb', line 227

def nullable
  left.nullable && right.nullable
end