Class: Idl::EnumDefinitionSyntaxNode

Inherits:
Treetop::Runtime::SyntaxNode show all
Defined in:
lib/idl/ast.rb

Instance Method Summary collapse

Instance Method Details

#to_astObject



965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
# File 'lib/idl/ast.rb', line 965

def to_ast
  values = []

  e.elements.each do |e|
    if e.i.empty?
      values << nil
    else
      values << e.i.int.to_ast
    end
  end

  EnumDefinitionAst.new(
    input,
    interval,
    user_type_name.to_ast,
    e.elements.map { |entry| entry.user_type_name.to_ast },
    values
  )
end