1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. private with Ada.Strings.Unbounded; 
  10.  
  11. package Scripting.Expressions.Variables is 
  12.  
  13.     -- A Variable is a value of any type (boolean, number, or string) that will 
  14.     -- be resolved by name only when the expression is evaluated. 
  15.     type Variable is new Expression with private; 
  16.     type A_Variable is access all Variable'Class; 
  17.  
  18.     -- Creates a new Variable from a Token representing an indentifier name. 
  19.     function Create_Variable( token : not null A_Identifier_Token ) return A_Variable; 
  20.     pragma Postcondition( Create_Variable'Result /= null ); 
  21.  
  22. private 
  23.  
  24.     use Ada.Strings.Unbounded; 
  25.  
  26.     type Variable is new Expression with 
  27.         record 
  28.             name : Unbounded_String; 
  29.         end record; 
  30.  
  31.     procedure Construct( this : access Variable; loc : Token_Location; name : String ); 
  32.  
  33.     function Evaluate( this    : access Variable; 
  34.                        context : not null A_Eval_Context ) return Value_Ptr; 
  35.  
  36. end Scripting.Expressions.Variables;