[sv-ec] Jeda SV-EC errata:#11 Regular expression handling mechanism

From: eugene zhang <eugene@jedatechnologies.com>
Date: Tue Aug 31 2004 - 00:47:47 PDT

 

Title:
   Regular expression handling mechanism

Description:
   Regular expresson is a powerfull mechanism to handle text input. It
is clucial to have such a mechanism in a testbench language system to
manipulate various text base inputs in effective way. The system class
'regexp' is included as a part of IEEE 1364-2005 donation from Jeda
Technologies. The following is the description of the donated
mechanism. This donation suggested to implement it as the system-level
class (similar to 'semaphore' or 'event'), but it can also be
implemented using verilog system task mechanism.

  <regexp class in IEEE1364-2005 Jeda donation>

     11.4 Regular Expression Engine Class

       The class regexp is the regular expression pattern matching
engine. This class is based on
       the regular expression engine developed by University of Toronto
(written by Henry Spencer)
       with some Perl5 extensions (by Larry Wall).
       Note that NOT all the Perl5 features are supported in this class.

       The following member functions are provided:

         * function int match( string source, string regexp ) ;
           This function tries the regular expression match, and returns

1 if succeeded,
           or 0 otherwise.

         * function string prematch() ;
           This function returns the prematch string from the previous
match() call.

         * function string postmatch() ;
           This function returns the postmatch string from the previous
match() call.

         * function string thismatch() ;
           This function returns the matched string from the previous
match() call.

         * function string backref( int num )
           This function returns the match in the parentheses from the
previous match() call.

      The engine is extended with some of the Perl5 regular expression
features.
      The following special character features are supported.

         Code Matches
         . Any character (include '/n')
         \a Alarm (beep)
         \n New line
         \r Carriage return
         \t Tab
         \f Form feed
         \e Escape
         \d A digit, same as [0-9]
         \D A non digit
         \w A word character(alphanumeric), same as
[a-zA-Z_0-9]
         \W A nonword character
         \s A whitespace character, same as [ \t\n\r\f]
         \S A non-whitespace character
         \0 null character
         \<single digit> corresponding parentheses actually matched
         \<two or three octal digit> character with the octal value
         \x<one or two hex digit> character with the hex value
         \c<Single Character> Corresponding control character

         Supported Assertions

           Assertion Meaning
             ^ Matches at the beginning of the string
             $ Matches at the end of the string
             \b Matches at word boundary (between \w and \w)
             \B Matches except at word boundary

         Supported Quantifiers

           Quantifier Range
              * 0 or more times
              + 1 or more times
              ? 0 or 1 time
Received on Tue Aug 31 00:47:51 2004

This archive was generated by hypermail 2.1.8 : Tue Aug 31 2004 - 00:48:05 PDT