source: to-imperative/trunk/samples/select1.rf @ 432

Last change on this file since 432 was 432, checked in by pooh, 18 years ago
  • Workaround to allow program compilation.
  • Makefile rules changed to allow correct dependency checking.
  • Removed C++ versions of samples from CVS.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 906 bytes
Line 
1//$use Dos StdIO; //"timer";
2$use StdIO;
3
4$func  MkArg  eString = ePrefixes;
5$func  Select (eXs) eSets = eXs-or-sFail; * (eXs) or '*'
6$func? OneOf  (eXs) sX = ;
7
8Main =   /*<PrintLN <Time>>,*/
9         <MkArg "1234567890ab"> :: e.Arg,
10         <PrintLN e.Arg>,
11         <Select () e.Arg> :: e.Res,
12         <PrintLN e.Res>,
13         //<Timer-BegProc " End ">::t,
14         /*<PrintLN <Time>>*/;
15MkArg e.String = * e.Prefixes
16   ( ) (e.String) $iter{
17      e.Prefix : e.Prefix-- s =
18        (e.Prefixes (e.Prefix)) (e.Prefix--) ;
19   } :: (e.Prefixes)            (e.Prefix),
20   e.Prefix : /*empty*/
21   = e.Prefixes;
22
23Select (e.Xs) e.Sets = * e.Xs-or-sFail -- (eXs) or '*'
24   e.Sets : {
25           /*empty*/ = (e.Xs);
26
27      (e.Set) e.Sets--,
28              e.Set : e sX e,
29         #<OneOf (e.Xs) sX>,
30         <Select (e.Xs sX) e.Sets--> : (e.Xs-) = (e.Xs-);
31
32           e = '*';
33   };
34
35OneOf (e.Xs) s.X = */
36   e.Xs : e s.X e;
Note: See TracBrowser for help on using the repository browser.