module ABNF::Parser::Node

Public Class Methods

alternation(node, abnf) click to toggle source
# File lib/abnf/parser/node.rb, line 4
def self.alternation node, abnf
  Alternation.new node, abnf
end
concatenation(children=nil, abnf) click to toggle source
# File lib/abnf/parser/node.rb, line 8
def self.concatenation children=nil, abnf
  children ||= Array(children)
  Sequence.new children, abnf
end
pattern_match(match_data, abnf) click to toggle source
# File lib/abnf/parser/node.rb, line 18
def self.pattern_match match_data, abnf
  PatternMatch.new match_data, abnf
end
repetition(children=nil, abnf) click to toggle source
# File lib/abnf/parser/node.rb, line 13
def self.repetition children=nil, abnf
  children ||= Array(children)
  Sequence.new children, abnf
end
terminal(text, abnf) click to toggle source
# File lib/abnf/parser/node.rb, line 22
def self.terminal text, abnf
  Single.new text, abnf
end

Public Instance Methods

==(other_node) click to toggle source
# File lib/abnf/parser/node.rb, line 26
def == other_node
  return false unless other_node.is_a? Node
  self.text == other_node.text and self.abnf == other_node.abnf
end
[](index) click to toggle source
# File lib/abnf/parser/node.rb, line 31
def [] index
  children[index]
end
child_count() click to toggle source
# File lib/abnf/parser/node.rb, line 39
def child_count
  children.size
end
children() click to toggle source
# File lib/abnf/parser/node.rb, line 35
def children
  []
end
each(&block) click to toggle source
# File lib/abnf/parser/node.rb, line 43
def each &block
  children.each &block
end
octets() click to toggle source
# File lib/abnf/parser/node.rb, line 47
def octets
  text.bytesize
end