Index

Package: Evaluators

Description

package Scripting.Evaluators is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Evaluator

type Evaluator is new Limited_Object with private;

Ancestors:

Primitive operations:

Delete (overriding Objects.Delete)
Objects.Construct (Inherited)
Objects.To_String (Inherited)
An Evaluator can parse and evaluate scripts and expressions. Currently only expressions are supported for evaluation. Symbols and functions in expressions are resolved by an object implementing the Evaluation_Node interface. The Evaluator can be reused to perform multiple evaluations on different input and it is recommended that objects not be created and deleted for every evaluation, to limit overhead.

Types

A_Evaluator

type A_Evaluator is access all Evaluator'Class;

Subprograms & Entries

Create_Evaluator

function Create_Evaluator return A_Evaluator;
Creates a new Evaluator to evaluate text script/expressions.

Evaluate_Expression

function Evaluate_Expression
( this: not null access Evaluator'Class;
expression: String;
evalNode: A_Evaluation_Node ) return Value_Ptr;
Evaluates the text of 'expression' and returns 'result'. Specify 'evalNode' to evaluate symbols and functions by name during evaluation. If the expression couldn't be evaluated due to a runtime error, Null will be returned. (For example, a variable couldn't be resolved or a value type mismatch occured.) If a parsing error occurs then Parse_Exception will be raised. If an error occurs while evaluating symbols or functions with the evaluation node, Evaluation_Exception will be raised.

Evaluate_Script

procedure Evaluate_Script
( this: not null access Evaluator'Class;
text: String;
evalNode: A_Evaluation_Node );
Evaluates a script in 'text', using 'resolver' and 'func_eval' as necessary to resolve variable names and evaluate functions. A script is simply a list of statements terminated by semicolons. If a parsing error occurs then Parse_Exception will be raised. If an error occurs while evaluating symbols or functions with the evaluation node, Evaluation_Exception will be raised.

Delete

procedure Delete
( this: in out A_Evaluator );
Deletes the Evaluator.