struct Pars::ParseResult(T)
- Pars::ParseResult(T)
- Struct
- Value
- Object
Overview
ParseResult(T) is a result of a parsed Parser with return type T.
Defined in:
pars/parse_result.crConstructors
-
.new(value : T, context : Pars::ParseContext)
Creates a new successful
ParseResult
.
Class Method Summary
-
.error(message : String, context : ParseContext)
Creates an errored
ParseResult
. -
.error(e : ParseError)
Creates an errored
ParseResult
that wraps e.
Instance Method Summary
- #context
-
#error! : ParseError
Directly access the
ParseError
. -
#error? : ParseError | Nil
Returns a
ParseError
, or nil if parsing was successful. - #errored
-
#value : T | ParseError
Returns the parsed value, or a
ParseError
. -
#value! : T
Directly access to parsed value.
Constructor Detail
Class Method Detail
Instance Method Detail
def error! : ParseError
#
Directly access the ParseError
.
Note: this unsafe and should only be used if #errored == true
.