Rev | Line | |
---|
[3952] | 1 | $module "refal.plus.XML"; |
---|
| 2 | |
---|
| 3 | $use Convert Stream StdIO; |
---|
| 4 | |
---|
| 5 | $func? GetTag s.stream = e.text (e.tag); |
---|
| 6 | |
---|
| 7 | GetTag s.stream = |
---|
| 8 | <Get_Delim s.stream '<'> : e.text '<', |
---|
| 9 | <Get_Delim s.stream '>'> : e.tag '>', |
---|
| 10 | e.text ('<' e.tag '>'); |
---|
| 11 | |
---|
| 12 | $func ReadTag s.stream e.tag = t; |
---|
| 13 | |
---|
| 14 | ReadTag s.stream e.tag, e.tag : { |
---|
| 15 | '<' e.name '/>' = |
---|
| 16 | (<ToWord e.name>); |
---|
| 17 | '<' e.name '>' = |
---|
| 18 | <GetTag s.stream> $iter e.text <ReadTag s.stream e.tag> <GetTag s.stream> :: e.text (e.tag), |
---|
| 19 | e.tag : '</' e.name '>', |
---|
| 20 | (<ToWord e.name> e.text); |
---|
| 21 | }; |
---|
| 22 | |
---|
| 23 | $public $func Read s = t; |
---|
| 24 | |
---|
| 25 | Read s.stream = <GetTag s.stream> : (e.tag), <ReadTag s.stream e.tag>; |
---|
| 26 | |
---|
| 27 | $func Main = e; |
---|
| 28 | |
---|
| 29 | Main = |
---|
| 30 | <WriteLn <Read <Expr_Open '<Z>as<C/><B>b<Z></Z></B><C>c</C></Z>'>>>; |
---|
Note: See
TracBrowser
for help on using the repository browser.