library/string.m:
Delete long-deprecated substring/3 function and substring/4 predicate.
The newly introduced `string_piece' type has a substring/3 data
constructor which takes (start, end) offsets into the base string,
whereas the function and predicate take (start, count) arguments.
To reduce potential confusion, delete the deprecated function and
predicate.
Delete other deprecated substring predicates and functions as well.
tests/general/Mercury.options:
tests/general/string_foldl_substring.exp:
tests/general/string_foldl_substring.m:
tests/general/string_foldr_substring.exp:
tests/general/string_foldr_substring.m:
tests/hard_coded/Mercury.options:
tests/hard_coded/string_substring.m:
Delete tests for deprecated predicates.
tests/tabling/mercury_java_parser_dead_proc_elim_bug.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.m:
tests/valid/mercury_java_parser_follow_code_bug.m:
Replace calls to unsafe_substring with unsafe_between.
NEWS:
Announce the changes.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
Branches: main
Deprecate string.substring, string.foldl_substring, etc. in favour of
new procedures named string.between, string.foldl_between, etc.
The "between" procedures take a pair of [Start, End) endpoints instead
of Start, Count arguments. The reasons for this change are:
- the "between" procedures are more convenient
- "between" should be unambiguous. You can guess that it takes an End
argument instead of a Count argument without looking up the manual.
- Count arguments necessarily counted code units, but when working with
non-ASCII strings, almost the only way that the values would be arrived at
is by substracting one end point from another.
- it paves the way for a potential change to replace string offsets with an
abstract type. We cannot do that if users regularly have to perform a
subtraction between two offsets.
library/string.m:
Add string.foldl_between, string.foldl2_between,
string.foldr_between, string.between.
Deprecate the old substring names.
Replace string.substring_by_codepoint by string.between_codepoints.
compiler/elds_to_erlang.m:
compiler/error_util.m:
compiler/rbmm.live_variable_analysis.m:
compiler/timestamp.m:
extras/posix/samples/mdprof_cgid.m:
library/bitmap.m:
library/integer.m:
library/lexer.m:
library/parsing_utils.m:
mdbcomp/trace_counts.m:
profiler/demangle.m:
Conform to changes.
tests/general/Mercury.options:
tests/general/string_foldl_substring.exp:
tests/general/string_foldl_substring.m:
tests/general/string_foldr_substring.exp:
tests/general/string_foldr_substring.m:
tests/hard_coded/Mercury.options:
tests/hard_coded/string_substring.m:
Test both between and substring procedures.
tests/hard_coded/string_codepoint.exp:
tests/hard_coded/string_codepoint.exp2:
tests/hard_coded/string_codepoint.m:
Update names in test outputs.
NEWS:
Announce the change.
Branches: main
library/string.m:
Add Java versions of string functions.
Fix integer overflow in slow version of substring/4, as can happen when
someone passes max_int for Count.
tests/hard_coded/Mmakefile:
tests/hard_coded/contains_char_2.exp:
tests/hard_coded/contains_char_2.m:
tests/hard_coded/string_append_iii.exp:
tests/hard_coded/string_append_iii.m:
tests/hard_coded/string_append_ioi.exp:
tests/hard_coded/string_append_ioi.m:
tests/hard_coded/string_append_ooi.exp:
tests/hard_coded/string_append_ooi.m:
tests/hard_coded/string_set_char.exp:
tests/hard_coded/string_set_char.m:
tests/hard_coded/string_split_2.exp:
tests/hard_coded/string_split_2.m:
tests/hard_coded/string_sub_string_search.exp:
tests/hard_coded/string_sub_string_search.m:
tests/hard_coded/string_substring.exp:
tests/hard_coded/string_substring.m:
Add some test cases.