swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Related Concepts  
control structure  

do skip

 
 

Syntax

  do skip ((past numeric-expression) |
        (over pattern) |
        (past numeric-expression over pattern))
     local-declaration*
     action*
  (else
     local-declaration*
      action*)?
  done


Purpose

An action that offers an efficient way of skipping selected blocks of data.

The block of input to be skipped by a do skip action is described by specifying its length as a numeric-expression or the pattern that terminates it. When both are given, the specified number of characters are skipped first, then the do skip action looks for the pattern.

A common application for the do skip action is skipping header information. For example, the following rule will skip over the four characters following the matched "HEADER/", also skipping up to and over the next slash character:

  find "header/"
     do skip past 4 done
     do skip over "/" done

A do skip action with no actions in it simply continues with the following action, whether or not it succeeded.

In a do skip...over action, any pattern variables are available for use only within the actions up to the else or done keyword, whichever comes first. The relationship between the pattern and the actions is the same as that between the pattern and the actions in a match part of a do scan action.

The following code illustrates where the pattern variable "last-word" can and cannot be referenced:

  translate "*header/"
    do skip over (word-start letter* word-end) => last-word "/"
      output last-word                ; allowed
    else
      output last-word                ; not allowed
    done
    output last-word                  ; not allowed

over and lookahead can be combined in a do skip:

  do skip past 4 over lookahead "/" done

      Related Concepts
   Skipping input
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:11 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.