class Keisan::StringAndGroupParser::CommentPortion

Attributes

string[R]

Public Class Methods

new(expression, start_index) click to toggle source
# File lib/keisan/string_and_group_parser.rb, line 161
def initialize(expression, start_index)
  super(start_index)

  if expression[start_index] != '#'
    raise Keisan::Exceptions::TokenizingError.new("Comment should start with '#'")
  else
    index = start_index + 1
  end

  while index < expression.size
    break if expression[index] == "\n"
    index += 1
  end

  @end_index = index
  @string = expression[start_index...end_index]
end

Public Instance Methods

size() click to toggle source
# File lib/keisan/string_and_group_parser.rb, line 179
def size
  string.size
end
to_s() click to toggle source
# File lib/keisan/string_and_group_parser.rb, line 183
def to_s
  string
end