2.1. test/tre/tre-1.01

Start felix section to test/tre/tre-1.01-0.flx[1 /1 ]
     1: #line 9427 "./lpsrc/tre.pak"
     2: #import <flx.flxh>
     3: include "tre.flx";
     4: open Tre;
     5: open C_hack;
     6: open Carray;
     7: 
     8: print$ "Using tre " tre_version; endl;
     9: 
    10: var r = tre_regcomp("(a|b)*abb");
    11: print "Done tre compile"; endl;
    12: 
    13: print
    14:   match r with
    15:   | Some _ => "Compiled"
    16:   | None => "failed"
    17:   endmatch
    18: ;
    19: endl;
    20: 
    21: 
    22: var re : tre_regex_t =
    23:   match r with
    24:   | Some ?re => re
    25:   | None => re // HACK!
    26:   endmatch
    27: ;
    28: 
    29: var s = "aabbabababb";
    30: res,n,a := tre_regexec re s;
    31: print "Result = "; print res; endl;
    32: print "nmatches = "; print n; endl;
    33: 
    34: var i : int;
    35: for_each { i=0; } { i<n } { ++i; }
    36:   {
    37:     if int(a.[i].rm_so) == -1 do
    38:       print i; print " -> nomatch\n";
    39:     else
    40:       print i; print "-> match '";
    41:       start := int(a.[i].rm_so);
    42:       finish := int(a.[i].rm_eo);
    43:       print s.[start to finish];
    44:       print "'"; endl;
    45:     done;
    46:   }
    47: ;
    48: 
    49: print "Finished"; endl;
End felix section to test/tre/tre-1.01-0.flx[1]
Start data section to test/tre/tre-1.01-0.expect[1 /1 ]
     1: Using tre TRE 0.7.2 (GPL)
     2: Done tre compile
     3: Compiled
     4: Result = 0
     5: nmatches = 2
     6: 0-> match 'aabbabababb'
     7: 1-> match 'b'
     8: Finished
End data section to test/tre/tre-1.01-0.expect[1]