class Frepl::Declaration

Attributes

assigned_value[R]
kind[R]
len[R]
type[R]
variable_name[R]

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/frepl/statements/declaration.rb, line 9
def ==(other)
  if other.is_a?(Declaration)
    self.variable_name == other.variable_name
  else
    super(other)
  end
end
accept(visitor) click to toggle source
# File lib/frepl/statements/declaration.rb, line 5
def accept(visitor)
  visitor.visit_declaration(self)
end
pointer?() click to toggle source
# File lib/frepl/statements/declaration.rb, line 21
def pointer?
  @pointer != nil
end
target?() click to toggle source
# File lib/frepl/statements/declaration.rb, line 17
def target?
  @target != nil
end

Private Instance Methods

parse() click to toggle source
# File lib/frepl/statements/declaration.rb, line 27
def parse
  match_data = line.match(Frepl::Classifier::DECLARATION_REGEX)
  variable_part = match_data[7]
  variable_data = variable_part.match(/\s*(#{Frepl::Classifier::VARIABLE_NAME_REGEX})\s*+=*\s*(.*)?/)
  @variable_name = variable_data[1]
  kind_len = match_data[2]
  if kind_len
    value = kind_len.match(/=?+([^=\(\)(?:kind|len)]+)/)[1]
    if kind_len.match(/kind/)
      @kind = value
    else
      @len = value
    end
  end
  @assigned_value = variable_data[2].empty? ? nil : variable_data[2]
  @type = match_data[1]
  @target = match_data[5]
  @pointer = match_data[6]
end