class Calcula::Exprs::ParamsExpr

Expression for representing parameter lists (for functions)

@author Paul T.

Public Class Methods

new(params) click to toggle source

@param params [Array<Calcula::Token>] The tokens should all have type of ID

# File lib/Exprs/ParamsExpr.rb, line 9
def initialize(params)
  @params = params
end

Public Instance Methods

children() click to toggle source

@see Calcula::Expr#children @param (see Calcula::Expr#children) @return (see Calcula::Expr#children)

# File lib/Exprs/ParamsExpr.rb, line 30
def children
  []
end
to_s(form: :src) click to toggle source

@see Calcula::Expr#to_s @param (see Calcula::Expr#to_s) @return (see Calcula::Expr#to_s)

# File lib/Exprs/ParamsExpr.rb, line 16
def to_s(form: :src)
  case form
  when :src then
    @params.collect { |e| e.text }.join(',')
  when :tree, :ruby then
    "(#{self})"
  else
    nil
  end
end