source: to-imperative/trunk/samples/select.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: 881 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 = sBool-T-or-F;
7
8Main =   /*<PrintLN <Time>>,*/
9         <MkArg "1234567890ab"> :: e.Prefixes,
10         <PrintLN e.Prefixes>,
11         <Select () e.Prefixes> :: eXs-or-sFail,
12         <PrintLN eXs-or-sFail>,
13         //<PrintLN  t.StartTime>,
14         /*<PrintLN <Time>>*/;
15
16MkArg e.String = * e.Prefixes
17   e.String:{ 
18      e.String-- s = (e.String) <MkArg e.String-->;
19           /* empty */  = ;
20        };
21
22Select (e.Xs) e.Sets = * e.Xs-or-sFail -- (eXs) or '*'
23   e.Sets : {
24           /*empty*/ = (e.Xs);
25
26      (e.Set) e.Sets--,
27              e.Set : e sX e,
28         <OneOf (e.Xs) sX> : F,
29         <Select (e.Xs sX) e.Sets--> : (e.Xs-) = (e.Xs-);
30
31           e = '+';
32   };
33
34OneOf (e.Xs) s.X =
35   e.Xs : {
36           e sX e = T;
37
38           e      = F;
39   };
Note: See TracBrowser for help on using the repository browser.