Companion

A default context that includes Modules.BASE, Modules.MATH and Operators.POWER.

Expression and result caching is enabled for this context. Result caching can be manually turned off for any expression parsed by this context using KthExpression.disableCache.

Functions

Link copied to clipboard
@JvmName(name = "calculateResultExt")
open override fun String.calculateResult(): KthParsingAndCalculationResult

Parses an arithmetic expression from the receiving string, then return its result.

Parses an arithmetic expression from the given string, then return its result.

Link copied to clipboard
@JvmName(name = "calculateResultWithExt")
open override fun String.calculateResultWith(vararg inputVars: Pair<String, Number>): KthParsingAndCalculationResult

Parses an arithmetic expression from the receiving string, then return its result.

open override fun calculateResultWith(expr: String, vararg inputVars: Pair<String, Number>): KthParsingAndCalculationResult

Parses an arithmetic expression from the given string, then return its result.

Link copied to clipboard
open override fun clearCache()

Clears the expression cache of the context.

Link copied to clipboard
open override fun copy(builder: KthContext.Builder.() -> Unit): KthContext

Copies this context to create a new context containing the same elements.

Link copied to clipboard
@JvmName(name = "parseExpressionExt")
open override fun String.parseExpression(): KthParsingResult

Parses an arithmetic expression from the receiving string.

open override fun parseExpression(expr: String): KthParsingResult

Parses an arithmetic expression from the given string.

Link copied to clipboard
@JvmName(name = "parseExpressionWithExt")
open override fun String.parseExpressionWith(vararg declaredVars: String): KthParsingResult

Parses an arithmetic expression from the receiving string and given declared variables.

open override fun parseExpressionWith(expr: String, vararg declaredVars: String): KthParsingResult

Parses an arithmetic expression from the given string and declared variables.