validateFunction

Validates the math library's fucntion syntax.

TODO: Make syntax rules modular.

nothrow pure @safe @nogc
bool
validateFunction
(
dstring funcbody
)

Parameters

funcbody dstring

The body of the function to validate.

Return Value

Type: bool

true if the function has correct syntax, false otherwise.

Examples

dstring func = "x + 1"d;
assert(validateFunction(func));
func = "x^^2 + 2^^2 j- 3"d;
assert(!validateFunction(func));
func = "x.3";
assert(!validateFunction(func));
func = "()";
assert(!validateFunction(func));
func = "x ^ 3";
assert(!validateFunction(func));
func = "x +";
assert(!validateFunction(func));
assert(!validateFunction("x ++ 1"d));

Meta