/usr/share/ada/adainclude/opentoken/opentoken-token-list_mixin.ads is in libopentoken4-dev 5.0a-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | -------------------------------------------------------------------------------
--
-- Copyright (C) 2009 Stephe Leake
-- Copyright (C) 2000 Ted Dennison
--
-- This file is part of the OpenToken package.
--
-- The OpenToken package 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 3, or (at your option)
-- any later version. The OpenToken package 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 distributed with the OpenToken
-- package; see file GPL.txt. If not, write to the Free Software Foundation,
-- 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 package defines a generic list token for recursive descent
-- parsers. A list is a token that is made up of any number of
-- repetitions of other tokens, separated by a given separator token.
-------------------------------------------------------------------------------
generic
type Parent_Token is abstract new OpenToken.Token.Instance with private;
type Component_Token is abstract new OpenToken.Token.Instance with private;
package OpenToken.Token.List_Mixin is
type Instance is new Parent_Token with private;
subtype Class is Instance'Class;
type Handle is access all Class;
type List_Action is access procedure (List : in out Instance);
type Element_Action is access procedure
(List : in out Instance;
Element : in Component_Token'Class);
----------------------------------------------------------------------------
-- Return a new list token
----------------------------------------------------------------------------
function "**"
(Element : access Component_Token'Class;
Separator : access OpenToken.Token.Class)
return Instance;
----------------------------------------------------------------------
-- Add an Add_Element action to the instance
----------------------------------------------------------------------
function "*"
(Token : in Instance;
Add_Element : in Element_Action)
return Handle;
----------------------------------------------------------------------
-- Add an Initialize action to the instance
----------------------------------------------------------------------
function "+"
(Token : in Handle;
Initialize : in List_Action)
return Handle;
----------------------------------------------------------------------
-- Add a Build action to the instance
----------------------------------------------------------------------
function "-"
(Token : in Handle;
Build : in List_Action)
return Handle;
function Get
(Element : access Component_Token'Class;
Separator : access OpenToken.Token.Class;
Name : in String := "";
Lookahead : in Integer := Default_Lookahead;
Initialize : in List_Action := null;
Add_Element : in Element_Action := null;
Build : in List_Action := null)
return Instance;
function New_Instance
(Token : in Instance;
Name : in String := "";
Lookahead : in Integer := Default_Lookahead;
Initialize : in List_Action := null;
Add_Element : in Element_Action := null;
Build : in List_Action := null)
return Handle;
procedure Set_Lookahead (Token : in out Instance; Lookahead : in Integer);
--------------------------------------------------------------------------
-- Initialize is called before anything else happens.
--
-- Add_Element is called with every successive list element
-- that is recognized.
--
-- Build is called when the entire list has been recognized.
--------------------------------------------------------------------------
overriding procedure Parse
(Match : access Instance;
Analyzer : in out Source_Class;
Actively : in Boolean := True);
overriding procedure Expecting (Token : access Instance; List : in out Linked_List.Instance);
private
type Component_Handle is access all Component_Token'Class;
type Instance is new Parent_Token with record
Element : Component_Handle;
Separator : OpenToken.Token.Handle;
Lookahead : Integer;
Initialize : List_Action;
Add_Element : Element_Action;
Build : List_Action;
end record;
end OpenToken.Token.List_Mixin;
|