StringSearch:SubstringBM

Import List

    Object
    Object
    RT0
    StringSearch
    StringSearch:SubstringBF
 
Class List
FactoryThis class implements the Boyer-Moore string searching algorithm.
MatchObject
Matcher
Class Summary: Factory [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---StringSearch.Factory
                 |
                 +--StringSearch:SubstringBM.Factory

This class implements the Boyer-Moore string searching algorithm. With a pattern length of M and a string length of N, a search operation never requires more than M+N character comparisons, and about N/M steps if the alphabet is not small and the pattern is not long.

Constructor Summary
InitFactory(Factory)

          
Method Summary
Compile(String8, Flags): Matcher

          Compile a expression, for example a regular expression pattern, into a Matcher expression object.
Inherited Methods

From RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode, ToString

From StringSearch.Factory:

          Compile, Destroy

 
Class Summary: MatchObject [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---StringSearch.MatchObject
                 |
                 +---StringSearch:SubstringBF.MatchObject
                      |
                      +--StringSearch:SubstringBM.MatchObject
Inherited Fields

From StringSearch.MatchObject:

          endpos, matcher, pos, string

Inherited Methods

From RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode, ToString

From StringSearch.MatchObject:

          Destroy

From StringSearch:SubstringBF.MatchObject:

          End, Start

 
Class Summary: Matcher [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---StringSearch.Matcher
                 |
                 +---StringSearch:SubstringBF.Matcher
                      |
                      +--StringSearch:SubstringBM.Matcher
Inherited Fields

From StringSearch.Matcher:

          flags, groups, pattern

Method Summary
Search(String8, LONGINT, LONGINT): MatchObject

          Like Matcher.SearchChars, but works on an instance of Object.String8.
SearchChars(ARRAY OF CHAR, LONGINT, LONGINT): MatchObject

          Scans through string looking for a location where this Matcher produces a match, and return a corresponding MatchObject instance.
Inherited Methods

From RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode, ToString

From StringSearch.Matcher:

          Destroy

From StringSearch:SubstringBF.Matcher:

          Match, MatchChars, Search, SearchChars

 
Procedure Summary
SearchStart(Matcher, ARRAY OF CHAR, LONGINT, LONGINT): LONGINT

          PRIVATE.
Variable Summary
factory-: Factory

          
Constant Summary
copyString

          See StringSearch.copyString.
ignoreCase

          See StringSearch.ignoreCase.

Class Detail: Factory
Constructor Detail

InitFactory

PROCEDURE InitFactory(f: Factory)
Method Detail

Compile

PROCEDURE (f: Factory) Compile(pattern: String8; 
                  flags: Flags): Matcher

Compile a expression, for example a regular expression pattern, into a Matcher expression object. The matcher object can be used for matching using its Matcher.MatchChars and Matcher.SearchChars methods.

The pattern's behaviour can be modified by specifying a flags value. The set can include of the following variables: ignoreCase, copyString.

Result is NIL if the given pattern is invalid.

Pre-condition: The value of pattern does not contain the character 0X.

[Description inherited from Compile]

Redefines: Compile

 
Class Detail: MatchObject
 
Class Detail: Matcher
Method Detail

Search

PROCEDURE (matcher: Matcher) Search(string: String8; 
                 pos: LONGINT; 
                 endpos: LONGINT): MatchObject

Like Matcher.SearchChars, but works on an instance of Object.String8.

[Description inherited from Search]

Redefines: Search, Search


SearchChars

PROCEDURE (matcher: Matcher) SearchChars(string: ARRAY OF CHAR; 
                      pos: LONGINT; 
                      endpos: LONGINT): MatchObject

Scans through string looking for a location where this Matcher produces a match, and return a corresponding MatchObject instance. Returns NIL if no position in the string matches the pattern. Note that this is different from finding a zero-length match at some point in the string.

The pos and endpos parameters have the same meaning as for the Matcher.MatchChars method.

[Description inherited from SearchChars]

Redefines: SearchChars, SearchChars

 
Procedure Detail

SearchStart

PROCEDURE SearchStart(matcher: Matcher; 
                      string: ARRAY OF CHAR; 
                      pos: LONGINT; 
                      endpos: LONGINT): LONGINT

PRIVATE. Used by module RegexpDFA.

Variable Detail

factory

VAR factory-: Factory
Constant Detail

copyString

CONST copyString 

See StringSearch.copyString.


ignoreCase

CONST ignoreCase 

See StringSearch.ignoreCase.