swirl
Guide to OmniMark 9   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
 
 

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.