1------------------------------------------------------------------------------ 2-- -- 3-- Matreshka Project -- 4-- -- 5-- XML Processor -- 6-- -- 7-- Runtime Library Component -- 8-- -- 9------------------------------------------------------------------------------ 10-- -- 11-- Copyright © 2010-2014, 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: 4777 $ $Date: 2014-03-29 11:52:24 +0400 (Sat, 29 Mar 2014) $ 43------------------------------------------------------------------------------ 44pragma Ada_2012; 45 46private package XML.SAX.Simple_Readers.Scanner is 47 48 function YYLex (Self : in out Simple_Reader'Class) return Token; 49 -- Returns next token. 50 51 procedure Set_Document_Version_And_Encoding 52 (Self : in out Simple_Reader'Class; 53 Version : XML_Version; 54 Encoding : League.Strings.Universal_String); 55 -- Switch scanner to continue scanning according to the specified 56 -- version of XML specification. On error reports fatal error. 57 58 procedure Initialize (Self : in out Simple_Reader'Class); 59 -- Initializes start condition stack. 60 61 procedure Finalize (Self : in out Simple_Reader'Class); 62 -- Release scanner stack. 63 64 function Push_Entity 65 (Self : in out Simple_Reader'Class; 66 Entity : Matreshka.Internals.XML.Entity_Identifier; 67 In_Document_Type : Boolean; 68 In_Literal : Boolean) return Boolean; 69 -- Pushs replacement text of the entity into the scanner stack and push 70 -- base URI scope. Resolve entity when necessary. 71 72private 73 74 function YY_Text 75 (Self : Simple_Reader'Class; 76 Trim_Left : Natural := 0; 77 Trim_Right : Natural := 0; 78 Trim_Whitespace : Boolean := False) 79 return Matreshka.Internals.Strings.Shared_String_Access; 80 -- Converts matched data into shared string and returns it. For performance 81 -- reason, this subprogram is not UTF-16 aware and assume that all leading 82 -- and traling characters belong BMP. 83 84 procedure YY_Move_Backward (Self : in out Simple_Reader'Class); 85 pragma Inline (YY_Move_Backward); 86 -- Moves current position one step backward. It is intended to be used when 87 -- pattern has trailing context. For performance reason, this subprogram 88 -- is not UTF-16 and end-of-line tracking aware, it assumes that all 89 -- characters in trailing context belongs BMP and not affect end-of-line 90 -- tracking. 91 92 procedure Enter_Start_Condition 93 (Self : in out Simple_Reader'Class; 94 State : Interfaces.Unsigned_32); 95 pragma Inline (Enter_Start_Condition); 96 -- Enter a start condition. 97 98 procedure Push_Current_And_Enter_Start_Condition 99 (Self : in out Simple_Reader'Class; 100 Enter : Interfaces.Unsigned_32); 101 -- Pushs current start condition into the stack and set new start 102 -- condition. 103 104 procedure Push_And_Enter_Start_Condition 105 (Self : in out Simple_Reader'Class; 106 Push : Interfaces.Unsigned_32; 107 Enter : Interfaces.Unsigned_32); 108 -- Pushs first specified condition into the stack of start conditions and 109 -- enters second specified condition as current start condition. 110 111 procedure Pop_Start_Condition (Self : in out Simple_Reader'Class); 112 -- Set scanner's start condition from the stack of start conditions. 113 114 function Start_Condition 115 (Self : Simple_Reader'Class) return Interfaces.Unsigned_32; 116 -- Returns current start condition. 117 118 procedure Reset_Whitespace_Matched (Self : in out Simple_Reader'Class); 119 -- Resets "whitespace matched" flag. 120 121end XML.SAX.Simple_Readers.Scanner; 122