RosettaCodeData/Task/Determine-if-a-string-is-numeric/TMG/determine-if-a-string-is-numeric.tmg
2023-07-01 13:44:08 -04:00

20 lines
550 B
Text

prog: ignore(<< >>)
parse(line)\prog
parse(error)\prog;
line: number *;
number: ignore(none)
sign float (exp | ={})
= { < True: > 3 2 1 * };
sign: <+>={} | <->={<->} | ={};
float: int ( <.> decim = { 2 <.> 1 } | = { 1 } )
| <.> int = { <.> 1 };
int: smark any(digit) string(digit) scopy;
decim: smark string(digit) scopy;
exp: any(<<eE>>) sign int = { <e> 2 1 };
error: smark any(nonl) ignore(none) string(nonl) scopy * = { <False: > 1 * };
digit: <<0123456789>>;
none: <<>>;
nonl: !<<
>>;