Documentation
=============

This Document contains informations about:

TScript
TFuncs
TFunc
	TOnEvalEvent
	TArgList
TExpr
	-> TVarExpr
	-> TConstExpr
	-> TFuncExpr

  {
	This component holds the scipt code and its internal representation
	(code tree). The compilation and execution of script code is done
	by this component.
  }
  TScript = class (TComponent)
  public
	class function LineOfPos (memo : TMemo; pos : Integer) : Integer;
		// Calculates the line number (zero based) of the position "pos" in	the memo.
		
	class function ColOfPos (memo : TMemo; pos : Integer) : Integer;
		// Calculates the column number (one based) of the position "pos" in the memo

	procedure SetVar (name : string; value : Variant);
		// After a script is compiled you can set variables in the script to other values. 

	function GetVar (name : string) : Variant;
		// After execution of a script you can read the final values of each variable
		// used in the script. Works also in TFunc.OnEval events.

	procedure Compile;
		// Compiles the script located in "Text"

	procedure Execute;
		// Executes the script. If the script is not yet compiled this will be done now.
	
	procedure ShowTree (tv : TTreeView);
		// Shows the syntax tree generated by then procedure "Compile"

	property  Result : Variant {read only};
		// Returns the value of the variable result in the script
		
	property  Compiled : boolean; {read only}
		// Determines wheter the script is compiled or not
  published
	property Exceptions : Boolean read scrExceptions write scrExceptions;
		// If set to true, syntax and runtime errors in the script will result 
		// in Exceptions. If set to false TScript will popup some message
		// boxes to indicate errors.
		
	property Text : TStrings read scrText write SetText;
		// Stores the program code of the script. 
		
	property Functions : TFuncs read scrFuncs write SetFuncs;
		// The TFuncs component used by TScript. The script only "knows" 
		// functions and procedures defined in this TFuncs component.
  end;

  {
	The component TFuncs is a container for TFunc components. You don't
	need to add TFunc component manually. A TFunc component adds its
	encapsulated TFunction object automatically.
  }
  TFuncs = class (TComponent)
  public
	procedure AddFunction (fnc : TFunction);
		// Adds a TFunction to the component
		
	procedure DeleteFunction (fnc : TFunction);
		// Deletes a function stored in this component
		
	function GetFunction (nam : string) : TFunction;
		// Returns the TFunction object for the function called "nam"
  end;

  {
	A TFunc component encapsulates a TFunction object. A TFunction object
	is the internal representation of a function for the script.
  }
  TFunc = class (TComponent)
  published
	property Declaration : string;
		// Declares the name of the function (used in the script) and
		// the number an types of the arguments. Syntax is described in
		// Syntax.txt
		
	property Funcs : TFuncs;
		// The TFuncs component to that this component belongs.
		
	property OnEval : TOnEvalEvent;
		// This event is called everytime this function is called in the script.
		// See TOnEvalEvent and TArgList below
  end;

  TOnEvalEvent = procedure (Sender : TObject; args : TArgList; var Result : Variant) of Object;
		// args holds the arguments of the function call
		// If the TFunc component represents a function the  result value have 
		// to be returned using the "Result" var parameter

  TArgList = class
  public
	property arg[x : Integer] : TExpr; default;
		// Used to access the arguments of the function call
	property Count : Integer read GetCount;
		// The number of arguments actually present for this call.
  end;
  
  TExpr = class
  public
	function Eval : Variant; virtual; abstract;
		// Evaluates the expression
		
	property Name : String;
		// The name of the expressioin
		
	property ResType : TAttrType;
		// The type of the expressions result
  end;

  TConstExpr = class (TExpr)
  public
	function Eval : Variant; override;
		// returns a constant value
  end;

  TVarExpr = class (TExpr)
  public
	function Eval : Variant; override;
		// Returns the value of the connected TVariable object

	procedure SetValue (v : Variant);
		// Sets the value of the connected TVariable object
  end;

  TFuncExpr = class (TExpr)
  public
	function Eval : Variant; override;
		// Evaluates the connected TFunction object using the arguments
		// added with "AddArg"
		
	procedure AddArg (expr : TExpr);
		// Adds an argument to the function
  end;




