Class: Chelsy::BitField

Inherits:
Element show all
Defined in:
lib/chelsy/ast.rb

Overview

Struct or Union member with bit-field

Unnamed bit-field :: A bit-field declaration with no declarator, but only a colon and a width

Instance Attribute Summary collapse

Attributes inherited from Element

#fragments, #post_fragments

Instance Method Summary collapse

Constructor Details

#initialize(bits, declaration = nil, **rest) ⇒ BitField

Returns a new instance of BitField.



162
163
164
165
166
167
# File 'lib/chelsy/ast.rb', line 162

def initialize(bits, declaration=nil, **rest)
  @declaration = Syntax::Declaration.ensure(declaration) if declaration
  @bits = bits && Syntax::BitField.ensure(bits)

  super **rest
end

Instance Attribute Details

#bitsObject (readonly)

Returns the value of attribute bits.



160
161
162
# File 'lib/chelsy/ast.rb', line 160

def bits
  @bits
end

#declarationObject (readonly)

Returns the value of attribute declaration.



160
161
162
# File 'lib/chelsy/ast.rb', line 160

def declaration
  @declaration
end