Expression.Tokenize

Syntax

Expression.Tokenize( options, initialParseState)

Return Value

Long

The return value represents the parsing state at the end of the expression.

If you individually tokenize each displayed line of an expression wrapped to multiple lines by a user interface control, pass this value to the initialParseState parameter of this method when you tokenize the next visible line.

Purpose

This method parses the expression text to identify the tokens that represent operators, identifiers, and constants. The capability to parse the expression into component tokens is useful for specialized purposes, such as implementing expression syntax coloring. Typically, you do not call this method.

Note You must call this method before you call the Expression.GetToken method or access the Expression.NumTokens property.

Parameters

options As Long

[In] Pass TokenizeOptions_NoOptions to specify the default behavior, or pass one or more TokenizeOptions constants. Use the bitwise-OR operator to specify multiple options. The Expression object retains the options you specify to use whenever it must tokenize the expression in the Expression.Validate and Expression.Evaluate methods.

initialParseState As Long

[In] Pass 0 if you are tokenizing a complete expression. Typically, you pass 0 to this parameter.

If you separately tokenize each visible line in an expression, pass 0 to tokenize the first visible line and pass the return value of this method from tokenizing the previous line to tokenize a subsequent line.

Note Tokenizing a multiline expression line-by-line is more efficient or convenient for certain specific applications, such as syntax-coloring text that displays in a control when the control wraps the text across multiple lines to fit within the control. In this case, you can resume tokenizing a logical line the control splits into multiple visible lines. Tokenize line-by-line to account for virtual new lines a control creates when wrapping expression text. If the expression contains actual new line characters, you can tokenize the entire expression with a single call to this method.

See Also

Expression.Evaluate

Expression.GetToken

Expression.NumTokens

Expression.Validate

TokenizeOptions