Module: Musa::Neumalang::Neumalang::Parser::Parameters Private
- Defined in:
- lib/musa-dsl/neumalang/neumalang.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Semantic action for function/event parameters.
Parses parameter lists for events and commands. Separates positional parameters, keyword parameters, and proc parameters.
Instance Method Summary collapse
-
#value ⇒ Hash
private
Builds parameters structure.
Instance Method Details
#value ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Builds parameters structure.
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/musa-dsl/neumalang/neumalang.rb', line 327 def value value_parameters = [] key_value_parameters = {} captures(:parameter).each do |pp| p = pp.value if p.has_key? :key_value key_value_parameters.merge! p[:key_value] else value_parameters << p[:value] end end {}.tap do |_| _[:value_parameters] = value_parameters unless value_parameters.empty? _[:key_parameters] = key_value_parameters unless key_value_parameters.empty? _[:proc_parameter] = capture(:codeblock).value if capture(:codeblock) end end |