Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

Regex Conv

DEFINITION MODULE RegexConv;

(* Conversion of Regular Expressions *)

TYPE
    Status = (
        success,
        invalidAWKRegex,
        invalidM2Regex,
        targetStringFull,
        allocationFailed );


(* ---------------------------------------------------------------------------
 * function:  RegexConv.awkToM2Regex( awkExpr, m2Expr, status )
 * ---------------------------------------------------------------------------
 *
 * Converts string <awkExpr> in AWK regular expression syntax to target string
 * <m2Expr> in Modula-2 regular expression syntax.
 *
 * The status of the operation is passed back in <status>. *)

PROCEDURE awkToM2Regex ( CONST awkExpr : ARRAY OF CHAR;
                         VAR m2Expr    : ARRAY OF CHAR;
                         VAR status    : Status );


(* ---------------------------------------------------------------------------
 * function:  RegexConv.m2RegexToAWK( m2Expr, awkExpr, status )
 * ---------------------------------------------------------------------------
 *
 * Converts string <m2Expr>  in Modula-2 regular expression syntax  to  target
 * string <awkExpr> in AWK regular expression syntax.
 *
 * The status of the operation is passed back in <status>. *)

PROCEDURE m2RegexToAWK ( CONST m2Expr : ARRAY OF CHAR;
                         VAR awkExpr  : ARRAY OF CHAR;
                         VAR status   : Status );


END RegexConv.