File : marks-scanners-fixed.ads
-- Marks.Scanners.Fixed (decl)
--
-- Mark-scanning for marks defined by fixed prefix and (optional)
-- suffix strings, and selected by a fixed command-line option
-- or a fixed file-name suffix. Lotta fixes here, eh.
--
-- Copyright (c) 2009 Tidorum Ltd.
--
-- This file is part of Find_Marks.
--
-- Find_Marks 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 of the License, or
-- (at your option) any later version.
--
-- This program 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 program. If not, see <http://www.gnu.org/licenses/>.
package Marks.Scanners.Fixed is
type String_Ref is access all String;
--
-- A reference to a string on the heap.
type Scanner_T is new Scanners.Scanner_T with record
Comment_Prefix : String_Ref;
Mark_Prefix : String_Ref;
Mark_Suffix : String_Ref;
Option : String_Ref;
File_Suffix : String_Ref;
end record;
--
-- Scanning source-code lines for marks defined by the prefix
-- and suffix strings.
--
-- This scanner classifies source-code lines as "markable"
-- iff they do *not* begin with the Comment_Prefix (after
-- possible leading white-space).
--
-- Among the non-markable lines, this scanner recognizes mark
-- lines that consist of:
--
-- > Possible leading white-space.
--
-- > The Mark_Prefix (which includes the Comment_Prefix).
--
-- > An optional list of mark properties, as defined by
-- Find_Mark_Properties, separated by white-space.
--
-- > A list of zero or more marker names, separated by
-- white-space and terminated by Mark_Suffix (if not
-- the null string, "") or end of line.
--
-- If the list of marker names is terminated by the
-- Mark_Suffix the rest of the line is not inspected and
-- can contain anything.
--
-- This scanner is selected:
--
-- > by this command-line Option, or
-- > for a file with this File name Suffix, if not "".
--
-- No String_Ref component should be null (the null access)
-- although some of them may refer to an empty string ("").
--
-- The Comment_Prefix and Mark_Prefix should never be "".
--
-- If the Mark_Suffix is "" it is not used; the list
-- or marker names goes on to the end of the mark line.
--
-- if the File_Suffix is "" it matches file-names that
-- have no suffix.
-- overriding
procedure Scan (
Line : in String;
Scanner : in out Scanner_T;
Markable : out Boolean);
-- overriding
procedure Handle_Option (
Option : in String;
Scanner : in out Scanner_T;
Valid : out Boolean;
Chosen : out Boolean);
-- overriding
function Suffix_Chooses_Me (
Suffix : String;
Scanner : Scanner_T)
return Boolean;
end Marks.Scanners.Fixed;