Skip to content

Commit

Permalink
Add a comment about the undefinedness
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrepta committed Jan 18, 2024
1 parent 78a51e0 commit c36d415
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions k-distribution/include/kframework/builtin/domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,9 @@ of the above operations in K.
requires findString(Source, ToReplace, 0) <Int 0
// Note that the replace function is undefined when Count < 0. This allows different backends to
// implement their own behavior without contradicting these semantics. For instance, a symbolic
// backend can return #Bottom for that case, while a concrete backend can throw an exception.
rule replace(Source:String, ToReplace:String, Replacement:String, Count:Int) =>
substrString(Source, 0, findString(Source, ToReplace, 0)) +String Replacement +String
replace(substrString(Source, findString(Source, ToReplace, 0) +Int lengthString(ToReplace), lengthString(Source)), ToReplace, Replacement, Count -Int 1)
Expand Down

0 comments on commit c36d415

Please sign in to comment.