class Kalculator

Author: Benjamin Walter Newhall, 12/17/19, github: bennewhall Explanation: much like the data sources class, this stores type data in the form {“variable-name”=>String}

Author: Benjamin Walter Newhall 12/17/19 github: bennewhall Explanation: A class that holds the types used for the validator

Author: Benjamin Walter Newhall 12/17/19, github: bennewhall Explanation: A class that will either return the ending type of an ast, or throw an error with metadata information about error position Usage: v = Validator.new(typesource) (typesource is a TypeSources object)

v.validate(ast)                     (ast is the ast returned by parsing a line)(this will either return a type or throw an Error as described in the errors.rb file)

Constants

BUILT_IN_FUNCTIONS
VERSION

Public Class Methods

evaluate(formula, data_source = {}, custom_functions = {}) click to toggle source
# File lib/kalculator.rb, line 22
def self.evaluate(formula, data_source = {}, custom_functions = {})
  Kalculator::Formula.new(formula).evaluate(data_source, custom_functions)
end
new(*args) click to toggle source
# File lib/kalculator.rb, line 28
def self.new(*args)
  Kalculator::Formula.new(*args)
end
parse(formula) click to toggle source
# File lib/kalculator.rb, line 32
def self.parse(formula)
  Kalculator::Parser.parse(Kalculator::Lexer.lex(formula))
end
validate(formula, type_source = Kalculator::TypeSources.new(Hash.new) ) click to toggle source
# File lib/kalculator.rb, line 25
def self.validate(formula,  type_source = Kalculator::TypeSources.new(Hash.new) )
  Kalculator::Formula.new(formula).validate(type_source)
end