[Snowball-discuss] SnowballProgram feature
Marios Sintichakis
mms at archetypon.com
Fri Jul 15 14:52:41 BST 2005
Hello,
According to the manual,
insert S
"inserts the variable or literal S before c, moving c to the right of the insert".
Java and C runtime differ in the implementation of this command. Consider the
following program
stringescapes {}
externals (main)
define main as (
repeat (
next
not atlimit insert '-'
)
)
With the C runtime, input string 'testme' becomes 't-e-s-t-m-e'. With
the Java runtime however, the result is '-'. I guess that method
replace_s(int, int, String)
in class SnowballProgram mistakenly passes instance variables bra ([) and ket (])
instead of its arguments when calls current.replace(int, int, String).
Taking into account that method setCurrent(String) sets bra and ket to cursor
and limit respectivelly, the objerved behaviour is justified.
So, most probably the call
current.replace(bra, ket, s);
should be changed to
current.replace(c_bra, c_ket, s);
and additionally, method setCurrent(String) should perhaps initialize
both bra and ket to -1 in order to adhere to the manual: "For any
string, the slice ends should be assumed to be unset until they are set
with the two commands [, ]."
Best regards,
Marios
More information about the Snowball-discuss
mailing list