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.



2992
2993
2994
2995
2996
2997
# File 'lib/adlint/cc1/syntax.rb', line 2992

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

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



3000
3001
3002
# File 'lib/adlint/cc1/syntax.rb', line 3000

def expression
  @expression
end

#identifierObject (readonly)

Returns the value of attribute identifier.



2999
3000
3001
# File 'lib/adlint/cc1/syntax.rb', line 2999

def identifier
  @identifier
end

#symbolObject (readonly)

Returns the value of attribute symbol.



3001
3002
3003
# File 'lib/adlint/cc1/syntax.rb', line 3001

def symbol
  @symbol
end

#typeObject

Returns the value of attribute type.



3003
3004
3005
# File 'lib/adlint/cc1/syntax.rb', line 3003

def type
  @type
end

#valueObject

Returns the value of attribute value.



3002
3003
3004
# File 'lib/adlint/cc1/syntax.rb', line 3002

def value
  @value
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



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

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

#locationObject



3005
3006
3007
# File 'lib/adlint/cc1/syntax.rb', line 3005

def location
  @identifier.location
end

#to_sObject



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

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