Skip to content

Commit ffc7eb4

Browse files
Updating comments for index_of and last_index_of on characters
1 parent e7fbcd3 commit ffc7eb4

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

src/solvers/refinement/string_constraint_generator_indexof.cpp

+26-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ Author: Romain Brenguier, [email protected]
1313
1414
Function: string_constraint_generatort::add_axioms_for_index_of
1515
16-
Inputs: a string expression, a character expression and an integer expression
16+
Inputs:
17+
str - a string expression
18+
c - an expression representing a character
19+
from_index - an expression representing an index in the string
1720
1821
Outputs: a integer expression
1922
20-
Purpose: add axioms that the returned value is either -1 or greater than
21-
from_index and the character at that position equals to c
23+
Purpose: add axioms stating that the returned value is either:
24+
-1 if the string does not contain c
25+
an index greater than from_index such that the character of str at
26+
that position equals c and is the first occurence after from_index.
2227
2328
\*******************************************************************/
2429

@@ -350,6 +355,24 @@ exprt string_constraint_generatort::add_axioms_for_index_of(
350355
}
351356
}
352357

358+
/*******************************************************************\
359+
360+
Function: string_constraint_generatort::add_axioms_for_last_index_of
361+
362+
Inputs:
363+
str - a string expression
364+
c - an expression representing a character
365+
from_index - an expression representing an index in the string
366+
367+
Outputs: a integer expression
368+
369+
Purpose: add axioms stating that the returned value is either:
370+
-1 if the string does not contain c
371+
an index less than from_index such that the character of str at
372+
that position equals c and is the last occurence before from_index.
373+
374+
\*******************************************************************/
375+
353376
exprt string_constraint_generatort::add_axioms_for_last_index_of(
354377
const string_exprt &str, const exprt &c, const exprt &from_index)
355378
{

0 commit comments

Comments
 (0)