INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "General notion of a pattern matcher"
cluster: matcher
deferred class MATCHER
inherit

SEARCHER
end
feature -- Matching actions

match (s: STRING)
-- Match `pattern' against string `s'. The whole string must 
-- match. Set attributes `found' and - if match succeeded -
-- `start_position' and `end_position'.
require
s_exists: s /= void
pattern_compiled: compiled
ensure
found_set: found = matches (s)
position_set: found implies (start_position = 1 and end_position = s.count)

match_prefix (s: STRING)
-- Match `pattern' against any prefix of string `s'.
-- Set attributes `found' and - if match succeeded -
-- `start_position' and `end_position'.
require
s_exists: s /= void
pattern_compiled: compiled
ensure
found_set: found = matches_prefix (s)
position_set: found implies (start_position = 1 and end_position <= s.count)

match_suffix (s: STRING)
-- Match `pattern' against any suffix of string `s'.
-- Set attributes `found' and - if match succeeded -
-- `start_position' and `end_position'.
require
s_exists: s /= void
pattern_compiled: compiled
ensure
found_set: found = matches_suffix (s)
position_set: found implies (start_position >= 1 and end_position = s.count)

match_left_part (s: STRING)
-- Match `pattern' against any part (substring) of string `s'.
-- Matching is from left to right. Attributes `found' and -
-- if matched - `start_position' and `end_position' are set.
require
s_exists: s /= void
pattern_compiled: compiled
ensure
found_set: found = matches_suffix (s)
position_set: found implies (start_position >= 1 and end_position <= s.count)

match_right_part (s: STRING)
-- Match `pattern' against any part (substring) of string `s'.
-- Matching is from right to left. Attributes `found' and -
-- if matched - `start_position' and `end_position' are set.
require
s_exists: s /= void
pattern_compiled: compiled
ensure
found_set: found = matches_suffix (s)
position_set: found implies (start_position >= 1 and end_position <= s.count)
feature -- Matching questions

matches (s: STRING): BOOLEAN
-- Does string `s' matches with pattern? 
-- The whole string must match.
require
s_exists: s /= void
pattern_compiled: compiled

matches_prefix (s: STRING): BOOLEAN
-- Does any prefix of string `s' matches with pattern? 
require
s_exists: s /= void
pattern_compiled: compiled

matches_suffix (s: STRING): BOOLEAN
-- Does any suffix of string `s' matches with pattern? 
require
s_exists: s /= void
pattern_compiled: compiled

matches_left_part (s: STRING): BOOLEAN
-- Does any substring of `s' matches with pattern? 
-- Matching is from left to right.
require
s_exists: s /= void
pattern_compiled: compiled

matches_right_part (s: STRING): BOOLEAN
-- Does any substring of `s' matches with pattern? 
-- Matching is from right to left.
require
s_exists: s /= void
pattern_compiled: compiled
end -- class MATCHER

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES