Name 'nonstrict' in the UTF-8 library changed to 'lax'
It is not a good idea to use negative words to describe boolean
values. (When we negate that boolean we create a double negative...)
diff --git a/lutf8lib.c b/lutf8lib.c
index ec711c9..16cd68a 100644
--- a/lutf8lib.c
+++ b/lutf8lib.c
@@ -85,7 +85,7 @@
/*
-** utf8len(s [, i [, j [, nonstrict]]]) --> number of characters that
+** utf8len(s [, i [, j [, lax]]]) --> number of characters that
** start in the range [i,j], or nil + current position if 's' is not
** well formed in that interval
*/
@@ -95,13 +95,13 @@
const char *s = luaL_checklstring(L, 1, &len);
lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len);
lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len);
- int nonstrict = lua_toboolean(L, 4);
+ int lax = lua_toboolean(L, 4);
luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2,
"initial position out of string");
luaL_argcheck(L, --posj < (lua_Integer)len, 3,
"final position out of string");
while (posi <= posj) {
- const char *s1 = utf8_decode(s + posi, NULL, !nonstrict);
+ const char *s1 = utf8_decode(s + posi, NULL, !lax);
if (s1 == NULL) { /* conversion error? */
lua_pushnil(L); /* return nil ... */
lua_pushinteger(L, posi + 1); /* ... and current position */
@@ -116,7 +116,7 @@
/*
-** codepoint(s, [i, [j [, nonstrict]]]) -> returns codepoints for all
+** codepoint(s, [i, [j [, lax]]]) -> returns codepoints for all
** characters that start in the range [i,j]
*/
static int codepoint (lua_State *L) {
@@ -124,7 +124,7 @@
const char *s = luaL_checklstring(L, 1, &len);
lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len);
lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len);
- int nonstrict = lua_toboolean(L, 4);
+ int lax = lua_toboolean(L, 4);
int n;
const char *se;
luaL_argcheck(L, posi >= 1, 2, "out of range");
@@ -138,7 +138,7 @@
se = s + pose; /* string end */
for (s += posi - 1; s < se;) {
utfint code;
- s = utf8_decode(s, &code, !nonstrict);
+ s = utf8_decode(s, &code, !lax);
if (s == NULL)
return luaL_error(L, "invalid UTF-8 code");
lua_pushinteger(L, code);
@@ -249,15 +249,15 @@
return iter_aux(L, 1);
}
-static int iter_auxnostrict (lua_State *L) {
+static int iter_auxlax (lua_State *L) {
return iter_aux(L, 0);
}
static int iter_codes (lua_State *L) {
- int nonstrict = lua_toboolean(L, 2);
+ int lax = lua_toboolean(L, 2);
luaL_checkstring(L, 1);
- lua_pushcfunction(L, nonstrict ? iter_auxnostrict : iter_auxstrict);
+ lua_pushcfunction(L, lax ? iter_auxlax : iter_auxstrict);
lua_pushvalue(L, 1);
lua_pushinteger(L, 0);
return 3;
diff --git a/manual/manual.of b/manual/manual.of
index b7ced44..fc2550e 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -7315,7 +7315,7 @@
By default, they only accept byte sequences
that result in valid Unicode code points,
rejecting values greater than @T{10FFFF} and surrogates.
-A boolean argument @id{nonstrict}, when available,
+A boolean argument @id{lax}, when available,
lifts these checks,
so that all values up to @T{0x7FFFFFFF} are accepted.
(Not well formed and overlong sequences are still rejected.)
@@ -7338,7 +7338,7 @@
}
-@LibEntry{utf8.codes (s [, nonstrict])|
+@LibEntry{utf8.codes (s [, lax])|
Returns values so that the construction
@verbatim{
@@ -7351,7 +7351,7 @@
}
-@LibEntry{utf8.codepoint (s [, i [, j [, nonstrict]]])|
+@LibEntry{utf8.codepoint (s [, i [, j [, lax]]])|
Returns the codepoints (as integers) from all characters in @id{s}
that start between byte position @id{i} and @id{j} (both included).
@@ -7360,7 +7360,7 @@
}
-@LibEntry{utf8.len (s [, i [, j [, nonstrict]]])|
+@LibEntry{utf8.len (s [, i [, j [, lax]]])|
Returns the number of UTF-8 characters in string @id{s}
that start between positions @id{i} and @id{j} (both inclusive).