1: #line 835 "./lpsrc/flx_regress.pak" 2: //Check regmatch
3: // contrib by Valery, mod by Skaller 4: #import <flx.flxh> 5: 6: // emulate command line arguments 7: arguments := "--test", "words", "more words"; 8: argc := 3; 9: fun argv (i:int):string => 10: match i with 11: | 0 .. 2 => arguments.[i] 12: | _ => "" 13: endmatch 14: ; 15: 16: var i = 0; 17: whilst i < argc do 18: print "checking arg "; print i; print "="; print (argv i); endl; 19: regmatch (argv i) with 20: | "--test" => { print "test"; endl; } 21: | _* => { print "terminating"; endl; i = argc; } 22: endmatch; 23: i++; 24: done;
1: checking arg 0=--test 2: test 3: checking arg 1=words 4: terminating