Class: Idl::DollarFunctionCallSyntaxNode
- Inherits:
-
SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- SyntaxNode
- Idl::DollarFunctionCallSyntaxNode
- Defined in:
- lib/idlc/ast.rb
Overview
Generic syntax node for $name(arg, …) — dispatches to the correct typed AstNode in to_ast.
Instance Method Summary collapse
Methods inherited from Treetop::Runtime::SyntaxNode
#set_input_file, #set_input_file_unless_already_set, #space?
Instance Method Details
#to_ast ⇒ Object
5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 |
# File 'lib/idlc/ast.rb', line 5808 def to_ast dollar_name = "$#{send(:name).text_value}" arg_nodes = dollar_arg_list_elements enum_type_name_validation = { 0 => { classes: [IdAst, UserTypeNameAst], description: "an identifier or user type name" } } case dollar_name when "$width" then builtin_call_ast(dollar_name, arg_nodes, 1, WidthRevealAst) when "$signed" then builtin_call_ast(dollar_name, arg_nodes, 1, SignCastAst) when "$bits" then builtin_call_ast(dollar_name, arg_nodes, 1, BitsCastAst) when "$enum_size" then builtin_call_ast(dollar_name, arg_nodes, 1, EnumSizeAst, enum_type_name_validation) when "$enum_element_size" then builtin_call_ast(dollar_name, arg_nodes, 1, EnumElementSizeAst, enum_type_name_validation) when "$enum_to_a" then builtin_call_ast(dollar_name, arg_nodes, 1, EnumArrayCastAst, enum_type_name_validation) when "$enum" then builtin_call_ast(dollar_name, arg_nodes, 2, EnumCastAst, enum_type_name_validation) when "$array_size" then builtin_call_ast(dollar_name, arg_nodes, 1, ArraySizeAst) when "$array_includes?" then builtin_call_ast(dollar_name, arg_nodes, 2, ArrayIncludesAst) else ParseTimeDetectedTypeError.new(input, interval, "#{dollar_name} is not a builtin function") end end |