SML/NJ Library Manual


The REGEXP_PARSER signature


Synopsis

signature REGEXP_PARSER
structure AwkSyntax : REGEXP_PARSER

This is the signature of a concrete syntax for regular expressions. It provides functionality to converts strings of characters into the abstract syntax of regular expressions given in the RegExpSyntax structure. This is done by converting a character reader into an abstract syntax reader.

The AwkSyntax structure is a structure matching this signature. It implements the AWK syntax for specifying regular expressions. The syntax is defined on pp. 28-30 of "The AWK Programming Language," by Aho, Kernighan and Weinberger.

   Meta characters:
      "\" "^" "$" "." "[" "]" "|" "(" ")" "*" "+" "?"

   Atomic REs:
      c        matches the character c (for non-metacharacters c)
      "^"      matches the empty string at the beginning of a line
      "$"      matches the empty string at the end of a line
      "."      matches any single character (except \000 and \n)

   Escape sequences:
      "\b"     matches backspace
      "\f"     matches formfeed
      "\n"     matches newline (linefeed)
      "\r"     matches carriage return
      "\t"     matches tab
      "\"ddd   matches the character with octal code ddd.
      "\"c     matches the character c (e.g., \\ for \, \" for ")
      "\x"dd   matches the character with hex code dd.

    Compound regular expressions:
      A"|"B    matches A or B
      AB       matches A followed by B
      A"?"     matches zero or one As
      A"*"     matches zero or more As
      A"+"     matches one or more As
      "("A")"  matches A


Interface

val scan : (char,'a) StringCvt.reader -> (RegExpSyntax.syntax,'a) StringCvt.reader

Description

scan getc
Given a character reader getc, this function returns a reader that parses elements of the stream into the abstract syntax for regular expressions.


See Also

RegExpSyntax

[ Top | Parent | Contents | Index | Root ]

Last Modified June 3, 1998
Comments to John Reppy
Copyright © 1998 Bell Labs, Lucent Technologies