Skip to content

Commit

Permalink
Leave the string replace function undefined for count < 0
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrepta committed Jan 18, 2024
1 parent a2393f1 commit 78a51e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion k-distribution/include/kframework/builtin/domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,8 @@ of the above operations in K.
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)
requires Count >Int 0 andBool findString(Source, ToReplace, 0) >=Int 0
rule replace(Source:String, _, _, _) => Source [owise]
rule replace(Source:String, _, _, Count) => Source
requires Count >= 0 [owise]
rule replaceAll(Source:String, ToReplace:String, Replacement:String) => replace(Source, ToReplace, Replacement, countAllOccurrences(Source, ToReplace))
endmodule
Expand Down

0 comments on commit 78a51e0

Please sign in to comment.