Class: ABNF::Term

Inherits:
Elt
  • Object
show all
Defined in:
lib/abnf/abnf.rb,
lib/abnf/regexp.rb,
lib/abnf/regexp.rb,
lib/abnf/grammar.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Elt

#*, #+, #empty_sequence?, #remove_left_recursion, #remove_right_recursion, #rep, #|

Constructor Details

#initialize(natset) ⇒ Term

Returns a new instance of Term.



171
172
173
# File 'lib/abnf/grammar.rb', line 171

def initialize(natset)
  @natset = natset
end

Instance Attribute Details

#natsetObject (readonly)

Returns the value of attribute natset.



174
175
176
# File 'lib/abnf/grammar.rb', line 174

def natset
  @natset
end

Class Method Details

._newObject



160
# File 'lib/abnf/grammar.rb', line 160

alias _new new

.new(natset) ⇒ Object



163
164
165
166
167
168
169
# File 'lib/abnf/grammar.rb', line 163

def Term.new(natset)
  if natset.empty?
    EmptySet
  else
    Term._new(natset)
  end
end

Instance Method Details

#each_var(&block) ⇒ Object



180
# File 'lib/abnf/grammar.rb', line 180

def each_var(&block) end

#empty_set?Boolean

Returns:

  • (Boolean)


176
177
178
# File 'lib/abnf/grammar.rb', line 176

def empty_set?
  @natset.empty?
end

#recursion(syms, lhs) ⇒ Object



335
336
337
# File 'lib/abnf/regexp.rb', line 335

def recursion(syms, lhs)
  NonRecursion
end

#regexp_treeObject



393
# File 'lib/abnf/regexp.rb', line 393

def regexp_tree() RegexpTree.charclass(@natset) end

#remove_just_recursion(n) ⇒ Object



339
340
341
# File 'lib/abnf/regexp.rb', line 339

def remove_just_recursion(n)
  self
end

#split_left_recursion(n) ⇒ Object Also known as: split_right_recursion



343
344
345
# File 'lib/abnf/regexp.rb', line 343

def split_left_recursion(n)
  [self, EmptySet]
end

#split_recursion(n) ⇒ Object



348
349
350
# File 'lib/abnf/regexp.rb', line 348

def split_recursion(n)
  [EmptySet, self, EmptySet]
end

#subst_var(&block) ⇒ Object



181
# File 'lib/abnf/grammar.rb', line 181

def subst_var(&block) self end

#useful?(useful_names) ⇒ Boolean

Returns:

  • (Boolean)


124
# File 'lib/abnf/abnf.rb', line 124

def useful?(useful_names) true end