class AdLint::Cc1::ConstantSpecifier

Attributes

constant[R]

Public Class Methods

new(const) click to toggle source
Calls superclass method AdLint::Cc1::Expression::new
# File lib/adlint/cc1/syntax.rb, line 631
def initialize(const)
  super()
  @constant = const
end
of_zero(loc = nil) click to toggle source
# File lib/adlint/cc1/syntax.rb, line 627
def self.of_zero(loc = nil)
  self.new(Token.new(:CONSTANT, "0", loc || Location.new))
end

Public Instance Methods

arithmetic?() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 662
def arithmetic?
  false
end
bitwise?() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 666
def bitwise?
  false
end
character?() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 650
def character?
  @constant.value =~ /'.*'/
end
have_side_effect?() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 654
def have_side_effect?
  false
end
inspect(indent = 0) click to toggle source
# File lib/adlint/cc1/syntax.rb, line 687
def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{location.inspect}) " +
    "#{@constant.value}"
end
location() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 638
def location
  @constant.location
end
logical?() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 658
def logical?
  false
end
prefix() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 642
def prefix
  @constant.value.scan(/\A(?:0x|0b|0(?=[0-9])|L)/i).first
end
suffix() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 646
def suffix
  @constant.value.scan(/(?:[UL]+|[FL]+)\z/i).first
end
to_complemental_logical() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 679
def to_complemental_logical
  self
end
to_normalized_logical(parent_expr = nil) click to toggle source
# File lib/adlint/cc1/syntax.rb, line 670
def to_normalized_logical(parent_expr = nil)
  case parent_expr
  when nil, LogicalAndExpression, LogicalOrExpression
    create_normalized_logical_of(self)
  else
    self
  end
end
to_s() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 683
def to_s
  @constant.value
end