Class: AdLint::Cc1::Enumerator

Inherits:
SyntaxNode show all
Includes:
SymbolicElement
Defined in:
lib/adlint/cc1/syntax.rb

Instance Attribute Summary collapse

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods included from SymbolicElement

#mark_as_referred_by

Methods inherited from SyntaxNode

#head_location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(id, expr, sym) ⇒ Enumerator

Returns a new instance of Enumerator.



3011
3012
3013
3014
3015
3016
# File 'lib/adlint/cc1/syntax.rb', line 3011

def initialize(id, expr, sym)
  super()
  @identifier = id
  @expression = expr
  @symbol = sym
end

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



3019
3020
3021
# File 'lib/adlint/cc1/syntax.rb', line 3019

def expression
  @expression
end

#identifierObject (readonly)

Returns the value of attribute identifier.



3018
3019
3020
# File 'lib/adlint/cc1/syntax.rb', line 3018

def identifier
  @identifier
end

#symbolObject (readonly)

Returns the value of attribute symbol.



3020
3021
3022
# File 'lib/adlint/cc1/syntax.rb', line 3020

def symbol
  @symbol
end

#typeObject

Returns the value of attribute type.



3022
3023
3024
# File 'lib/adlint/cc1/syntax.rb', line 3022

def type
  @type
end

#valueObject

Returns the value of attribute value.



3021
3022
3023
# File 'lib/adlint/cc1/syntax.rb', line 3021

def value
  @value
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



3036
3037
3038
# File 'lib/adlint/cc1/syntax.rb', line 3036

def inspect(indent = 0)
  " " * indent + short_class_name
end

#locationObject



3024
3025
3026
# File 'lib/adlint/cc1/syntax.rb', line 3024

def location
  @identifier.location
end

#to_sObject



3028
3029
3030
3031
3032
3033
3034
# File 'lib/adlint/cc1/syntax.rb', line 3028

def to_s
  if @expression
    "#{@identifier.value} = #{@expression.to_s}"
  else
    "#{@identifier.value}"
  end
end