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

Spec.RegexConv History

Hide minor edits - Show changes to markup

2010-05-24 13:20 by benjk -
Changed lines 3-4 from:
to:

(* Conversion of Regular Expressions *)

Deleted lines 5-9:

// --------------------------------------------------------------------------- // Status codes // ---------------------------------------------------------------------------

Changed lines 11-37 from:
        allocationFailed);

// --------------------------------------------------------------------------- // function: Regex Conv.awkToM2Regex( awkExpr, m2Expr, status ) // --------------------------------------------------------------------------- // // Converts string <awkExpr> in AWK regular expression syntax to target string // <m2Expr> in M 2 Regex? regular expression syntax. // // The status of the operation is passed back in <status>.

PROCEDURE awkToM2Regex ( awkExpr : ARRAY OF CHAR; VAR m2Expr : ARRAY OF CHAR;

                         VAR status : Status );

// --------------------------------------------------------------------------- // function: Regex Conv.m2RegexToAWK( m2Expr, awkExpr, status ) // --------------------------------------------------------------------------- // // Converts string <m2Expr> in M 2 Regex? regular expression syntax to target // string <awkExpr> in AWK regular expression syntax. // // The status of the operation is passed back in <status>.

PROCEDURE m2RegexToAWK ( m2Expr : ARRAY OF CHAR; VAR awkExpr : ARRAY OF CHAR;

                         VAR status : Status );
to:
        allocationFailed );

(* ---------------------------------------------------------------------------

 * function:  Regex Conv.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:  Regex Conv.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 );
2010-03-04 17:57 by benjk -
Added lines 1-44:
DEFINITION MODULE RegexConv;


TYPE

// ---------------------------------------------------------------------------
// Status codes
// ---------------------------------------------------------------------------

    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 M2Regex regular expression syntax.
//
// The status of the operation is passed back in <status>.

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


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

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


END RegexConv.