Language

Type parsing

Strict parsers return a value, or they make a scene. Try-parsers write into slots you already prepared and tell you whether it worked.

Strict parsers

CallResult type
parsestrstr
parsenumnum
parsedecimaldecimal
parsescharschar
parsebooleanboolean
define num x is parsenum(readln);
define str processCountText is parsestr(processCount);

If a strict parse cannot convert the value, that is an error. She will not pretend.

Try-parsers

Three arguments: source, destination, success flag. Both destinations must already exist — usually born with new.

CallFills
tryparsenumnum + boolean
tryparsedecimaldecimal + boolean
tryparsescharschar + boolean
tryparsebooleanboolean + boolean
define num parsing is new;
define boolean success is new;
tryparsenum(goodParse, parsing, success);
showln success;
showln parsing;