class Blender3d::GenericFieldParser

Constants

ARRAY
FUNCTION_POINTER
MULTI_ARRAY
MULTI_POINTER
POINTER
POINTER_ARRAY

Public Class Methods

new(type, name) click to toggle source
# File lib/blender-3d/generic_field_parser.rb, line 10
def initialize(type, name)
  @type, @name = type, name
end

Public Instance Methods

parse() click to toggle source
# File lib/blender-3d/generic_field_parser.rb, line 14
def parse
  type = case @name
    when FUNCTION_POINTER
      FunctionPointerType.new(@type)

    when POINTER_ARRAY
      array_size = $2.to_i
      ArrayType.new(build_pointer_type, array_size)

    when MULTI_POINTER
      PointerType.new(build_pointer_type)

    when POINTER
      build_pointer_type

    when MULTI_ARRAY
      array1_size, array2_size = $2.to_i, $3.to_i
      ArrayType.new(ArrayType.new(build_simple_type, array2_size), array1_size)

    when ARRAY
      array_size = $2.to_i
      ArrayType.new(build_simple_type, array_size)

    else
      build_simple_type

  end

  name = $1 || @name
  Field.new(type, name)
end

Private Instance Methods

build_pointer_type() click to toggle source
# File lib/blender-3d/generic_field_parser.rb, line 46
        def build_pointer_type
  PointerType.new(build_simple_type)
end
build_simple_type() click to toggle source
# File lib/blender-3d/generic_field_parser.rb, line 50
        def build_simple_type
  SimpleType.new(@type)
end