1------------------------------------------------------------------------------ 2-- Templates Parser -- 3-- -- 4-- Copyright (C) 2005-2012, AdaCore -- 5-- -- 6-- This is free software; you can redistribute it and/or modify it -- 7-- under terms of the GNU General Public License as published by the -- 8-- Free Software Foundation; either version 3, or (at your option) any -- 9-- later version. This software is distributed in the hope that it will -- 10-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- 11-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- 12-- General Public License for more details. -- 13-- -- 14-- You should have received a copy of the GNU General Public License -- 15-- distributed with this software; see file COPYING3. If not, go -- 16-- to http://www.gnu.org/licenses for a complete copy of the license. -- 17------------------------------------------------------------------------------ 18 19with Ada.Text_IO; 20 21with Templates_Parser.Query; 22 23procedure TS_Assoc is 24 25 use Ada.Text_IO; 26 use Templates_Parser; 27 28 TS : Translate_Set; 29 30 procedure Display is 31 32 procedure Output (A : Association; Quit : in out Boolean) is 33 begin 34 Put_Line (">" & Query.Variable (A)); 35 end Output; 36 37 procedure Display_All_Assoc is new For_Every_Association (Output); 38 39 begin 40 Display_All_Assoc (TS); 41 end Display; 42 43 procedure Parse is 44 begin 45 Put_Line ("-----------------------------------"); 46 Put_Line (Parse ("ts_assoc.tmplt", TS, Keep_Unknown_Tags => True)); 47 end Parse; 48 49 A : Association; 50 51begin 52 Parse; 53 54 Insert (TS, Assoc ("NAME1", "one")); 55 Insert (TS, Assoc ("NAME2", "two")); 56 Display; 57 Parse; 58 59 A := Get (TS, "NAME2"); 60 Remove (TS, "NAME2"); 61 Parse; 62 63 Insert (TS, A); 64 Insert (TS, Assoc ("NAME1", "new one")); 65 Parse; 66 67 Remove (TS, "NAME1"); 68 Remove (TS, "NAME2"); 69 Parse; 70end TS_Assoc; 71