1------------------------------------------------------------------------------ 2-- -- 3-- Matreshka Project -- 4-- -- 5-- Localization, Internationalization, Globalization for Ada -- 6-- -- 7-- Tools Component -- 8-- -- 9------------------------------------------------------------------------------ 10-- -- 11-- Copyright © 2011-2015, Vadim Godunko <vgodunko@gmail.com> -- 12-- All rights reserved. -- 13-- -- 14-- Redistribution and use in source and binary forms, with or without -- 15-- modification, are permitted provided that the following conditions -- 16-- are met: -- 17-- -- 18-- * Redistributions of source code must retain the above copyright -- 19-- notice, this list of conditions and the following disclaimer. -- 20-- -- 21-- * Redistributions in binary form must reproduce the above copyright -- 22-- notice, this list of conditions and the following disclaimer in the -- 23-- documentation and/or other materials provided with the distribution. -- 24-- -- 25-- * Neither the name of the Vadim Godunko, IE nor the names of its -- 26-- contributors may be used to endorse or promote products derived from -- 27-- this software without specific prior written permission. -- 28-- -- 29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- 30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- 31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- 32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- 33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- 34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- 35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- 36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- 37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- 38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- 39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- 40-- -- 41------------------------------------------------------------------------------ 42-- $Revision: 5259 $ $Date: 2015-05-06 17:32:50 +0300 (Wed, 06 May 2015) $ 43------------------------------------------------------------------------------ 44 45with UAFLEX.Handlers; 46with UAFLEX.Lexer_Types; 47with Parser_Tokens; 48limited with UAFLEX.Scanners; 49 50package UAFLEX.Handler is 51 type Handler is new UAFLEX.Handlers.Handler with private; 52 53 procedure Skip 54 (Self : not null access Handler; 55 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 56 Rule : Lexer_Types.Rule_Index; 57 Token : out Parser_Tokens.Token; 58 Skip : in out Boolean) is null; 59 60 procedure Skip_Line 61 (Self : not null access Handler; 62 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 63 Rule : Lexer_Types.Rule_Index; 64 Token : out Parser_Tokens.Token; 65 Skip : in out Boolean); 66 67 procedure On_Start 68 (Self : not null access Handler; 69 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 70 Rule : Lexer_Types.Rule_Index; 71 Token : out Parser_Tokens.Token; 72 Skip : in out Boolean); 73 74 procedure On_Exclusive 75 (Self : not null access Handler; 76 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 77 Rule : Lexer_Types.Rule_Index; 78 Token : out Parser_Tokens.Token; 79 Skip : in out Boolean); 80 81 procedure On_Name 82 (Self : not null access Handler; 83 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 84 Rule : Lexer_Types.Rule_Index; 85 Token : out Parser_Tokens.Token; 86 Skip : in out Boolean); 87 88 procedure On_Section_End 89 (Self : not null access Handler; 90 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 91 Rule : Lexer_Types.Rule_Index; 92 Token : out Parser_Tokens.Token; 93 Skip : in out Boolean); 94 95 procedure On_Regexp 96 (Self : not null access Handler; 97 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 98 Rule : Lexer_Types.Rule_Index; 99 Token : out Parser_Tokens.Token; 100 Skip : in out Boolean); 101 102 procedure End_Of_Macro 103 (Self : not null access Handler; 104 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 105 Rule : Lexer_Types.Rule_Index; 106 Token : out Parser_Tokens.Token; 107 Skip : in out Boolean); 108 109 procedure End_Of_Name_List 110 (Self : not null access Handler; 111 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 112 Rule : Lexer_Types.Rule_Index; 113 Token : out Parser_Tokens.Token; 114 Skip : in out Boolean); 115 116 procedure On_Name_2 117 (Self : not null access Handler; 118 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 119 Rule : Lexer_Types.Rule_Index; 120 Token : out Parser_Tokens.Token; 121 Skip : in out Boolean); 122 123 procedure On_Regexp_2 124 (Self : not null access Handler; 125 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 126 Rule : Lexer_Types.Rule_Index; 127 Token : out Parser_Tokens.Token; 128 Skip : in out Boolean); 129 130 procedure On_Section_End_2 131 (Self : not null access Handler; 132 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 133 Rule : Lexer_Types.Rule_Index; 134 Token : out Parser_Tokens.Token; 135 Skip : in out Boolean); 136 137 procedure On_Action 138 (Self : not null access Handler; 139 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 140 Rule : Lexer_Types.Rule_Index; 141 Token : out Parser_Tokens.Token; 142 Skip : in out Boolean); 143 144 procedure On_End_Of_Rule 145 (Self : not null access Handler; 146 Scanner : not null access UAFLEX.Scanners.Scanner'Class; 147 Rule : Lexer_Types.Rule_Index; 148 Token : out Parser_Tokens.Token; 149 Skip : in out Boolean); 150 151 function Get_Line (Self : Handler) return Positive; 152 153private 154 155 procedure New_Line 156 (Self : not null access Handler'Class; 157 Scanner : not null access UAFLEX.Scanners.Scanner'Class); 158 159 procedure Check_New_Line (Self : not null access Handler'Class); 160 161 type Handler is new UAFLEX.Handlers.Handler with record 162 Line : Positive := 1; 163 Line_Feed : Boolean := False; -- The token is last in line 164 end record; 165 166end UAFLEX.Handler; 167