Class TCasScriptSequence

Unit

Declaration

type TCasScriptSequence = class(TCasScriptFunction)

Description

This item has no description.

Hierarchy

Overview

Methods

Public class function Name: string; override;
Public class function ShortName: string; override;
Public class function InfixOperatorName: string; override;

Description

Methods

Public class function Name: string; override;

This item has no description. Showing description inherited from TCasScriptFunction.Name.

Long function name for user. This is possibly with spaces, parenthesis and other funny characters. It will be used in error messages and such to describe this function.

Default implementation in this class simply returns ShortName. This should be suitable for most "norma" functions.

Public class function ShortName: string; override;

This item has no description. Showing description inherited from TCasScriptFunction.ShortName.

Short function name, for the parser. This is the name of the function for use in expressions like "function_name(arg_1, arg_2 ... , arg_n)".

This can be an empty string ('') if no explicit name for this function exists. This is useful for operators, which are implemented just like normal functions (a descendant of TCasScriptFunction), but with a special support from parser (e.g. to turn "x + b" into a call to the TCasScriptAdd function).

Public class function InfixOperatorName: string; override;

This item has no description. Showing description inherited from TCasScriptFunction.InfixOperatorName.

Function name when used as an infix operator.

Empty string ('') if no such name for this function. This is returned by default implementation of this in this class.

This does require cooperation from the parser to actually work, that is you cannot simply define new operators by registering new TCasScriptFunction with InfixOperatorName <> ''. For now.

Note that at least one of ShortName and InfixOperatorName must not be empty.

The only exception is the TCasScriptNegate function, that is neither infix operator nor a usual function that must be specified as "function_name(arguments)". So this is an exception, and if there will be a need, I shall fix this (probably by introducing some third field, like PrefixOperatorName ?)

Note 2 things:

  1. Function that can be used as infix operator (i.e. has InfixOperatorName <> '') is not necessary binary operator, i.e. InfixOperatorName <> '' does not determine the value of ArgsCount. This way I was able to define infix operators +, -, * etc. that take any number of arguments and operators like ˆ and > that always take 2 arguments.

  2. Function may have both ShortName <> '' and InfixOperatorName <> ''. E.g. TCasScriptPower can be used as "Power(3, 1.5)" or "3 ˆ 1.5".


Generated by PasDoc 0.16.0-snapshot.