source: trunk/forge/source/wiki/forge-wiki-parsers.ads@ 19

Last change on this file since 19 was 19, checked in by vadim.godunko, 7 years ago

Initial implementation of Wiki parser.

  • Property svn:keywords set to Author Date Revision
File size: 4.8 KB
Line 
1------------------------------------------------------------------------------
2-- --
3-- Forge on Ada --
4-- --
5-- Runtime Library Component --
6-- --
7------------------------------------------------------------------------------
8-- --
9-- Copyright © 2014, Vadim Godunko <vgodunko@gmail.com> --
10-- All rights reserved. --
11-- --
12-- Redistribution and use in source and binary forms, with or without --
13-- modification, are permitted provided that the following conditions --
14-- are met: --
15-- --
16-- * Redistributions of source code must retain the above copyright --
17-- notice, this list of conditions and the following disclaimer. --
18-- --
19-- * Redistributions in binary form must reproduce the above copyright --
20-- notice, this list of conditions and the following disclaimer in the --
21-- documentation and/or other materials provided with the distribution. --
22-- --
23-- * Neither the name of the Vadim Godunko, IE nor the names of its --
24-- contributors may be used to endorse or promote products derived from --
25-- this software without specific prior written permission. --
26-- --
27-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
28-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
29-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
30-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
31-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
32-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
33-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
34-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
35-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
36-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
37-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
38-- --
39------------------------------------------------------------------------------
40-- $Revision: 19 $ $Date: 2014-05-31 17:15:26 +0000 (Sat, 31 May 2014) $
41------------------------------------------------------------------------------
42private with Ada.Containers.Vectors;
43
44private with League.Regexps;
45with League.Strings;
46
47private with Forge.Wiki.Block_Parsers;
48
49package Forge.Wiki.Parsers is
50
51-- pragma Preelaborate;
52-- type Parser_Handler (Found : Boolean) is record
53-- case Found is
54-- when False =>
55-- null;
56--
57-- when True =>
58-- Handler :
59-- end case;
60-- end record;
61--
62-- type Block_Parser_Extension is limited interface;
63--
64-- not overriding function Parser (Self : Block_Parser_Extension) return Parser_Handler;
65--
66-- type Start_Pattern_Information is record
67-- Expression : League.Strings.Universal_String;
68-- Offset_Group : Positive;
69-- Total_Groups : Positive;
70-- end record;
71--
72-- type Block_Parser_Extension is limited interface;
73--
74-- not overriding function Start_Pattern
75-- (Self : Block_Parser_Extension) return Start_Pattern_Information
76-- is abstract;
77
78 -----------------
79 -- Wiki_Parser --
80 -----------------
81
82 type Wiki_Parser is tagged limited private;
83
84 procedure Parse
85 (Self : in out Wiki_Parser'Class; Data : League.Strings.Universal_String);
86 -- Parses given string.
87
88private
89
90-- type Initial_Block_Parser is new Abstract_Block_Parser with null record;
91
92 type Block_Parser_Access is
93 access all Forge.Wiki.Block_Parsers.Abstract_Block_Parser'Class;
94
95 package Block_Parser_Vectors is
96 new Ada.Containers.Vectors (Positive, Block_Parser_Access);
97
98 type Wiki_Parser is tagged limited record
99 Block_Regexp : League.Regexps.Regexp_Pattern;
100 Block_State : Block_Parser_Access;
101 Block_Stack : Block_Parser_Vectors.Vector;
102 end record;
103
104end Forge.Wiki.Parsers;
Note: See TracBrowser for help on using the repository browser.