Belp v0.1.0 Belp View Source
Belp is a simple Boolean Expression Lexer and Parser.
Link to this section Summary
Functions
Evaluates the given expression.
Evaluates the given expression. Raises when the expression is invalid or variables are undefined.
Checks whether the given expression is valid.
Gets a list of variable names that are present in the given expression.
Gets a list of variable names that are present in the given expression. Raises when the expression is invalid or variables are undefined.
Link to this section Types
A type that describes which primitives can be used as expression.
Link to this section Functions
eval(expr, vars \\ %{})
View Sourceeval( expr(), Keyword.t(as_boolean(any())) | %{optional(atom() | String.t()) => as_boolean(any())} ) :: {:ok, boolean()} | {:error, Belp.InvalidCharError.t() | Belp.SyntaxError.t() | Belp.UndefinedVariableError.t()}
Evaluates the given expression.
eval!(expr, vars \\ %{})
View Sourceeval!( expr(), Keyword.t(as_boolean(any())) | %{optional(atom() | String.t()) => as_boolean(any())} ) :: boolean() | no_return()
Evaluates the given expression. Raises when the expression is invalid or variables are undefined.
Checks whether the given expression is valid.
variables(expr)
View Sourcevariables(expr()) :: {:ok, [String.t()]} | {:error, Belp.InvalidCharError.t() | Belp.SyntaxError.t()}
Gets a list of variable names that are present in the given expression.
Gets a list of variable names that are present in the given expression. Raises when the expression is invalid or variables are undefined.