source: to-imperative/trunk/samples/select.rf @ 2470

Last change on this file since 2470 was 760, checked in by orlov, 18 years ago
  • Code formatting.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 824 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.