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

do scan

 
 

Syntax

do scan string-expression
   (match pattern condition?
      local-declaration*
      action*)+
   (else
      local-declaration*
      action*)?
done


Purpose

This scanning action specifies a number of match alternatives, each of which contains a sequence of actions to be performed if the value of the specified string expression matches the given pattern. The else phrase is optional. Only one else phrase may be used in a do scan action.

The actions in a match alternative are performed if the pattern matches all or part of the string expression. Each time a match alternative is tried, the pattern matching begins again at the beginning of the data to be scanned.

If a match alternative specifies a condition, then the condition must also be satisfied before the actions in that alternative will be executed.

A final sequence of actions can be preceded by the keyword else. Actions in the else condition will be performed if none of the other match alternatives are selected.

The following is a fairly standard do scan action that uses an else phrase. If the value of the "color" attribute is not black, gray, or blue, then the else phrase is selected:

  do scan attribute "color"
    match ul "black"
      output "\background(black)"
    match ul "gray" | ul "grey"
      output "\background(gray)"
    match ul "blue" | ul "cyan"
      output "\background(cyan)"
    else
      output "\background(black)" ; default color
  done

    Related Syntax
 
Related Concepts
 
 

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

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:51:21 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.