definy.parse-expression-text
- description
- Read an expression in the definy text syntax (the inverse of definy.expression-text. docs/expression-text.md)
- type
Fn(text: String) -> Union{#ok(@core.expression), #error(String)}- expression
fn(text$0) => let source$1 = {text: $0, bytes: @core.string-to-bytes(value: $0)}; match @definy.text-parse-expression(source: $1, index: 0) { #error(message$2) => #error($2), #ok(parsed$3) => let end$4 = @definy.text-skip(source: $1, index: $3.next); match @core.equal(left: $4, right: @core.list-length(value: $1.bytes)) { true => #ok($3.value), false => #error(@definy.text-error(message: "unexpected text after the expression", index: $4)) } }- visibility
- public
definy.parse-expression-text (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo) id: gcjFMoD5Cc9sOaK08nEN_SbwJwoV-JAlnD-23LzzZTI content hash: lD5-rVmrXu0SOy7OWN3n2nQErDigI11IwirOf3mqYU8