INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Regular expression matcher"
cluster: matcher
class REGEXP
inherit

MATCHER
end
creation

make,
make_insensitive,
make_sensitive
feature -- Modification

set_sensitive
-- Make the matcher case-sensitive.

set_insensitive
-- Make the matcher case-insensitive.

set_multi_line
-- Set matcher in multi-line mode. Mode is kept until matcher is
-- explicitely set to single-line mode.

set_single_line
-- Set matcher in single-line mode. Mode is kept until matcher is
-- explicitely set to multi-line mode.
feature -- Status report

multi_line: BOOLEAN

single_line: BOOLEAN
-- Is matcher in single-line mode? This is the default on object
-- creation.

number_of_subexpr: INTEGER

start_of_subexpr (i: INTEGER): INTEGER
-- Start position of the `i'th subexpression in the search string.
-- If `i'th subexpression was not part of the match 0 is returned.
require
successful_search: found
valid_index: i >= 1 and i <= number_of_subexpr
ensure
part_of_match: Result = 0 or else (Result >= start_position and Result <= end_position)

end_of_subexpr (i: INTEGER): INTEGER
-- End position of the `i'th subexpression in the search string.
-- If `i'th subexpression was not part of the match 0 is returned.
require
successful_search: found
valid_index: i >= 1 and i <= number_of_subexpr
ensure
part_of_match: Result = 0 or else (Result >= start_position and Result <= end_position)
feature -- Searching

search_forward (s: STRING; s_from, s_to: INTEGER)
-- Search for `pattern' in string `s'. Start searching at index
-- position `s_from' and search until the pattern matches (while
-- ignoring any characters behind `s_to'). If pattern matches, set
-- `found' to true and `start_position' and `end_position'
-- to the corresponding index positions (relative to the beginning
-- of the string). If the pattern contains subexpressions (r.e.'s
-- enclosed in `()') also record their start and end positions
-- in `s'. If the pattern doesn't match, set `found' to
-- false, but do not modify `start_position' or `end_position'.

search_backward (s: STRING; s_from, s_to: INTEGER)
-- Search for `pattern' in string `s'. Start searching at index
-- position `s_to' and search backward until the pattern matches
-- (ignoring any characters before `s_from'). If pattern matches,
-- set `found' to true and `start_position' and `end_position'
-- to the corresponding index positions (relative to the beginning
-- of the string). If the pattern contains subexpressions (r.e.'s
-- enclosed in `()') also record their start and end positions
-- in `s'. If the pattern doesn't match, set `found' to
-- false, but do not modify `start_position' or `end_position'.
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', and record start and end
-- position of any matched subexpression.

match_prefix (s: STRING)
-- Match `pattern' against any prefix of string `s'.
-- Matching is forward in `s'. Set attributes `found' and -
-- if match succeeded - `start_position' and `end_position'
-- and record start and end position of any matched subexpression.

match_suffix (s: STRING)
-- Match `pattern' against any suffix of string `s'.
-- Matching is backward in `s'. Set attributes `found' and -
-- if match succeeded - `start_position' and `end_position'
-- and record start and end position of any matched subexpression.

match_left_part (s: STRING)
-- Match `pattern' against any substring of string `s'.
-- Matching is from left to right. Set attributes `found' and -
-- if match succeeded - `start_position' and `end_position'
-- and record start and end position of any matched subexpression.

match_right_part (s: STRING)
-- Match `pattern' against any substring of string `s'.
-- Matching is from right to left. Set attributes `found' and -
-- if match succeeded - `start_position' and `end_position'
-- and record start and end position of any matched subexpression.
feature -- Matching questions

matches (s: STRING): BOOLEAN
-- Does string `s' matches with pattern? The whole string must
-- match. None of the position attributes nor `found' is modified.

matches_prefix (s: STRING): BOOLEAN
-- Does any prefix of string `s' matches with pattern?
-- Neither a position attribute nor `found' is modified.

matches_suffix (s: STRING): BOOLEAN
-- Does any suffix of string `s' matches with pattern?
-- Neither a position attribute nor `found' is modified.

matches_left_part (s: STRING): BOOLEAN
-- Does any substring of `s' matches with pattern?
-- Neither a position attribute nor `found' is modified.

matches_right_part (s: STRING): BOOLEAN
-- Does any substring of `s' matches with pattern?
-- Neither a position attribute nor `found' is modified.
end -- class REGEXP

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES