NAME
fromliteral - convert a string literal into a MOO value
SYNOPSIS
list fromliteral(string)
DESCRIPTION
The string argument is parsed as a MOO constant expression. If
the string forms a valid MOO value, the list {1, value} is
returned. Otherwise, {0, reason} is returned, where `reason'
is a string containing a short description of why the argument
could not be parsed.
This function is similar in semantics to
eval("return " + string + ";")
except that the string argument is guaranteed to be evaluated
as a constant literal, i.e. it cannot contain operators,
variable references, property references, or verb or builtin
calls.
For any MOO value, the following is always true:
fromliteral(toliteral(value)) == {1, value}
SEE ALSO
toliteral, eval