contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
Functions: greedy argument separator recognition
Prerequisite Concepts     Related Syntax  

Within a function call argument, recognition of the function argument separator that heralds an argument that can follow the current one predominates over the recognition of a name as a keyword or function name. For example, given the following function definition:

  define function copy-item modifiable stream s
            item value counter i as
       set s to s item i

the following call

  copy-item column-names item 3 item 7

is processed using the first item as the function argument separator and "3" as the second argument value. When the second item is encountered by OmniMark, it is considered to be in error.

A function argument separator for the next argument is recognized in this way:

If one or more of the following arguments are optional, then recognition of the separators for all of them, plus that of the following non-optional argument, if any, predominates recognition of any of those separators as keywords or function names.

If a function is called within an outer function call, and an argument separator satisfies the above point for both the inner and the outer function call, then it is considered to be part of the inner function call.

Separators are not recognized within parentheses ("(" and ")") unless the function call is contained entirely within the parentheses, brackets, or braces. In general, parentheses can be used to "protect" a keyword or function name from being recognized as a function argument separator.

The following call to the copy-item defined in the earlier example is valid, and identifies the first item as the indexer of the first argument, and the second item as the function argument separator in the copy-item function call:

  copy-item (column-name item 3) item 7

Recognition of separators occurs following macro call recognition and expansion, so parentheses, brackets and braces used in macro calls do not, in and of themselves, suppress recognition of separators.

Parentheses, brackets, and braces occurring in the expansion of a macro do suppress separator recognition. It is always wise to wrap macro expansion text in parentheses if there is any possibility of a keyword in the expansion being misinterpreted.

Prerequisite Concepts
     Functions
   Functions: argument classes
   Functions: argument recognition
   Functions: argument separators
 
  Related Syntax
   define function
 
----

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

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

Copyright © OmniMark Technologies Corporation, 1988-1999.