nitc :: ToolContext :: parse_expr
Fatal error if the string
is not a syntactically correct expression
# Parse a full expression given as a string
# Fatal error if the `string` is not a syntactically correct expression
fun parse_expr(string: String): AExpr
do
var mod_string = "var dummy = \n{string}"
var nmodule = parse_module(mod_string)
var nexpr = nmodule.n_classdefs.first.n_propdefs.first.as(AMethPropdef).n_block.as(ABlockExpr).n_expr.first.as(AVardeclExpr).n_expr.as(not null)
return nexpr
end
src/parser_util.nit:76,2--84,4