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. with Ada.Containers;                    use Ada.Containers; 
  10. with Ada.Containers.Doubly_Linked_Lists; 
  11. with Objects;                           use Objects; 
  12.  
  13. package Scripting.Statements is 
  14.  
  15.     -- A Statement represents a single command in a script. Scripts are composed 
  16.     -- of a series of statements. Statements can be evaluated/executed, but they 
  17.     -- don't return a value. 
  18.     type Statement is abstract new Limited_Object with private; 
  19.     type A_Statement is access all Statement'Class; 
  20.  
  21.     -- Evaluates the statement, performing whatever action it represents. Each 
  22.     -- Statement class overrides this procedure. 
  23.     procedure Evaluate( this    : access Statement; 
  24.                         context : not null A_Eval_Context ) is abstract; 
  25.  
  26.     -- Deletes the Statement. 
  27.     procedure Delete( this : in out A_Statement ); 
  28.     pragma Postcondition( this = null ); 
  29.  
  30.     ---------------------------------------------------------------------------- 
  31.  
  32.     package Statement_Lists is new Ada.Containers.Doubly_Linked_Lists( A_Statement, "=" ); 
  33.  
  34.     -- Deep deletes the list. 
  35.     procedure Delete_Contents( statements : in out Statement_Lists.List ); 
  36.     pragma Postcondition( Statement_Lists.Length( statements ) = 0 ); 
  37.  
  38. private 
  39.  
  40.     type Statement is abstract new Limited_Object with null record; 
  41.  
  42. end Scripting.Statements;