home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xco212p.zip / ODEF / REGCOMP.ODF < prev   
Text File  |  1996-03-05  |  1KB  |  43 lines

  1. (** Copyright (c) 1993 xTech Ltd, Russia. All Rights Reserved. *)
  2. (** Utility library: regular expressions *)
  3. DEFINITION RegComp;
  4.  
  5. TYPE
  6.   Expr*     = POINTER TO ExprDesc;
  7.   char_set* = POINTER TO ARRAY [0..7] OF SET;
  8.   RESULT*   = RECORD 
  9.   END;
  10.   ExprDesc* = RECORD 
  11.   END;
  12.  
  13. PROCEDURE Compile*(expr: ARRAY OF CHAR; VAR reg: Expr; VAR res: LONGINT);
  14. (** res <= 0 -- error in position ABS(res);
  15.     res >  0 -- done.
  16. *)
  17.  
  18. PROCEDURE Const*(re: Expr): BOOLEAN;
  19. (** Returns TRUE, if expression does not contain wildcards *)
  20.  
  21. PROCEDURE Match*(re: Expr; s: ARRAY OF CHAR; pos: LONGINT): BOOLEAN;
  22. (** Returns TRUE, iff expression matches with string "s" starting
  23.   from position "pos".
  24. *)
  25.  
  26. PROCEDURE Substitute*(re: Expr; s,m: ARRAY OF CHAR; VAR d: ARRAY OF CHAR);
  27. (** Substitutes  the substrings of "s" matched with "re" instead
  28.   of "$digit" in the "m" and copies the resulting string into "d".
  29. *)
  30.  
  31. PROCEDURE Len*(re: Expr; n: INTEGER): LONGINT;
  32. (** Returns the length of  the  substring matched to "$n"
  33.   at last call of match procedure with parameter "re".
  34. *)
  35.  
  36. PROCEDURE Pos*(re: Expr; n: INTEGER): LONGINT;
  37. (** Returns the position of the  beginning  of  the  substring
  38.   matched to "$n" at last call of match procedure with
  39.   parameter "re".
  40. *)
  41.  
  42. END RegComp.
  43.