contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
Localized pattern processing
    Related Syntax  

The pattern processor is invoked within a program by performing a submit action. The pattern processor then uses find rules to process the indicated input. For example, the following program will submit the string "abcd" to the find rules:

  find "a"
     output "found an 'A'%n"
  find "b"
     output "found a 'B'%n"

  process-start
     submit "abcd"

This program will have the following output:

  found an 'A'
  found a 'B'
  cd

Strings can be submitted to find rules from anywhere within a program.

A repeat scan similarly invokes the pattern processor, but only within a local scope. For example, the following process rule invokes the pattern processor and the string "abcd" is examined by the match statements:

  process
     repeat scan "abcd"
        match "a"
           output "found an 'A'%n"
        match "b"
           output "found a 'B'%n"
     again

The output from this rule will be:

  found an 'A'
  found a 'B'

The most obvious difference between a submit action and a repeat scan is that the submit sends a string to the find rules from anywhere in the program, while the repeat scan sends a string only to the match statements contained within the "repeat scan...again" block.

You will also notice that where the find rules simply pass any unmatched characters through to the output, the repeat scan contains a final "match any" statement which matches all characters that aren't matched by the earlier statements. If the match statements cannot match all of the characters in a string where there is no "default" behavior specified, and when an unmatchable character is encountered, the repeat scan is terminated. If the find rules don't match a character, the character, by default, is simply passed to the output. If the match statements don't match a character, the matching process is terminated.

Note that a file can be examined via a repeat scan:

  process
     repeat scan file "foo.txt"
        match ul ["aeiou"]
           output "found a vowel%n"
        match letter
           output "found a consonant%n"
        match space
           output "space%n "
        match any
           output "found a non-letter character%n"
     again

      Related Syntax
   submit
 
----

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

Generated: April 21, 1999 at 2:00:49 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-1999.