module SchemeChecker

Check if variable is specific type

Public Instance Methods

check_for_bool(token) click to toggle source
# File lib/lisp/interpreter/helpers/checker.rb, line 3
def check_for_bool(token)
  return true if token.boolean?
  is_instance_var = check_instance_var token
  return (check_for_bool get_var token) if is_instance_var
  false
end
check_for_num(token) click to toggle source
# File lib/lisp/interpreter/helpers/checker.rb, line 17
def check_for_num(token)
  return true if token.to_s.number?
  is_instance_var = check_instance_var token
  return (check_for_num get_var token) if is_instance_var
  false
end
check_for_quote(token) click to toggle source
# File lib/lisp/interpreter/helpers/checker.rb, line 24
def check_for_quote(token)
  return true if token[0].quote?
  is_instance_var = check_instance_var token
  return (check_for_num get_var token) if is_instance_var
  false
end
check_for_string(token) click to toggle source
# File lib/lisp/interpreter/helpers/checker.rb, line 10
def check_for_string(token)
  return true if token.string?
  is_instance_var = check_instance_var token
  return (check_for_string get_var token) if is_instance_var
  false
end
check_for_symbol(var) click to toggle source
# File lib/lisp/interpreter/helpers/checker.rb, line 31
def check_for_symbol(var)
  var = var.join('') if var.is_a? Array
  return true if var.character?
  is_instance_var = check_instance_var var
  return (check_for_character get_var var) if is_instance_var
  false
end
check_instance_var(var) click to toggle source
# File lib/lisp/interpreter/helpers/checker.rb, line 39
def check_instance_var(var)
  return false if var.is_a? Proc
  return false unless valid_var_name var
  @procs.key? var.to_s
end