swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Related Concepts  
pattern  

null

 
 

Syntax

  null pattern


Purpose

You can use the pattern modifier null to change OmniMark's default behavior for consecutive zero-length matches.

By default, OmniMark does not allow two consecutive matches that match zero characters. This prevents patterns from going into infinite loops in which the same pattern matches zero characters over and over again without progressing through the data.

Any pattern that is preceded by the null modifier is allowed to match zero characters even if the the previous match was zero-length:

  find null digit*

The above pattern will match and consume digits if it finds them. If it does not find digits, it will match anyway because matching nothing is allowed by the "zero-or-more" occurrence indicator (*). Because of the null modifier, it will go on matching zero characters without restriction.

If you use null in a pattern, you should make sure that the code that runs when the rule fires makes some state change that will eventually result in the rule not being fired. If you do not do so, your program will go into an infinite loop.

      Related Concepts
   Pattern matching
 
 

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

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

Copyright © Stilo Corporation, 1988-2005.