How ATEasy Searches for Variables

When a variable name is used in code, ATEasy will search for the variable to locate where it is defined. Since variables in different modules (or even in different submodules of the same module) can have the same name, ATEasy must decide which one is being referred to in the current code statement. ATEasy follows a specific search sequence and the first variable that ATEasy finds with the given name will be used.

To bypass the way ATEasy searches for a variable, you can also use the Scope Resolution Operator to specify where the variable is defined (for example, ModuleName.VariableName, such as 'Driver1.nCount'). For more information, see Scope Resolution Operator.

ATEasy statements are made up of a series of tokens. A token can be a keyword (for example, 'while'), an operator (for example, '+'), a literal (for example, number or a quoted string), or a variable name, and more. Depending on the statement used, ATEasy determines the possible token type and searches for it.

How ATEasy searches for a variable is important because variables defined in a Program, System or Driver module, or within a Procedure/Event or a Form can have the same name.

In general ATEasy will first search for a variable in the current module, the module where the variable is used, in the following order:

        If the variable is used in a Procedure or Event, ATEasy looks in the Procedure or Event variables or parameters.

        If the variable is used in a Control Event, ATEasy searches in the Control properties.

        If the variable is used in a Form Procedure or Event, ATEasy searches in the Form variables and then in Form properties.

        ATEasy then looks in the module variables and module COM libraries variables.

If the variable is not found, ATEasy will then search for public variables that are visible in other modules as follows:

        If the current module is a Program module, ATEasy searches in the System module and then in the System Drivers (starting from the last driver to the first).

        If the current module is a System module, ATEasy searches in the System Drivers (starting from the last driver to the first).

        If the current module is a Driver module, ATEasy searches in the System Drivers (starting from the last driver to the first).