1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110 | -- --
-- package Copyright (c) Dmitry A. Kazakov --
-- Parsers.Generic_Argument Luebeck --
-- Interface Winter, 2004 --
-- --
-- Last revision : 11:37 13 Oct 2007 --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public License as --
-- published by the Free Software Foundation; either version 2 of --
-- the License, or (at your option) any later version. This library --
-- is distributed in the hope that it will be useful, but WITHOUT --
-- ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
--____________________________________________________________________--
--
-- This generic package defines the base abstract type for argument
-- stacks. The generic parameter Argument_Type identifies appearance of
-- an argument in the source. Usually it is the argument and a source
-- location link.
--
with Ada.Finalization;
generic
type Argument_Type is private;
package Parsers.Generic_Argument is
--
-- Frame -- The argument list of an operation
--
type Argument_No is new Positive;
type Frame is array (Argument_No range <>) of Argument_Type;
--
-- Stack -- The argument stack
--
type Stack is abstract
new Ada.Finalization.Limited_Controlled with private;
--
-- Is_Empty -- Check if there are any arguments in the current fragment
--
-- Container - The argument stack
--
-- Returns :
--
-- True - if the current stack fragment is empty
--
function Is_Empty (Container : Stack) return Boolean is abstract;
--
-- Mark -- Create a new stack fragment
--
-- Container - The argument stack
--
-- A stack fragment represents an independent argument stack. No
-- arguments below mark can be accessed in any way until Release is
-- called.
--
procedure Mark (Container : in out Stack) is abstract;
--
-- Pop -- Argument frame from the stack top
--
-- Container - The argument stack
-- List - The argument list to fill in
--
-- Exceptions :
--
-- Constraint_Error - Not enough arguments
--
procedure Pop
( Container : in out Stack;
List : in out Frame
) is abstract;
--
-- Push -- An argument
--
-- Container - The argument stack
-- Argument - To push
--
procedure Push
( Container : in out Stack;
Argument : Argument_Type
) is abstract;
--
-- Release -- Remove the stack segment
--
-- Container - The argument stack
--
-- This procedure should be called for each call to Mark. If there are
-- any arguments on the stack pushed after the mark, they are removed.
--
-- Exceptions :
--
-- Constraint_Error - Empty stack
--
procedure Release (Container : in out Stack) is abstract;
private
type Stack is abstract
new Ada.Finalization.Limited_Controlled with null record;
end Parsers.Generic_Argument;
|