Class: RLSM::RE::Star

Inherits:
SyntaxNode show all
Defined in:
lib/rlsm/regexp_parser.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from SyntaxNode

#content

Instance Method Summary collapse

Methods inherited from SyntaxNode

#<=>, [], #initialize, #inspect, #null?

Constructor Details

This class inherits a constructor from RLSM::RE::SyntaxNode

Instance Method Details

#firstObject



345
346
347
# File 'lib/rlsm/regexp_parser.rb', line 345

def first
  @content.first
end

#followObject



353
354
355
356
357
358
359
360
361
362
363
# File 'lib/rlsm/regexp_parser.rb', line 353

def follow
  result = []

  @content.last.each do |char1|
    @content.first.each do |char2|
      result << [char1,char2]
    end
  end

  (@content.follow | result).sort
end

#lastObject



349
350
351
# File 'lib/rlsm/regexp_parser.rb', line 349

def last
  @content.last
end

#to_sObject



365
366
367
368
369
# File 'lib/rlsm/regexp_parser.rb', line 365

def to_s
  string  = @content.to_s

  string.length > 1 ? "(#{string})*" : "#{string}*"
end