diff options
Diffstat (limited to 'source/luametatex/source/tex/texlanguage.c')
-rw-r--r-- | source/luametatex/source/tex/texlanguage.c | 63 |
1 files changed, 13 insertions, 50 deletions
diff --git a/source/luametatex/source/tex/texlanguage.c b/source/luametatex/source/tex/texlanguage.c index 22627ee58..0fcd3b243 100644 --- a/source/luametatex/source/tex/texlanguage.c +++ b/source/luametatex/source/tex/texlanguage.c @@ -525,6 +525,7 @@ void tex_load_hyphenation(struct tex_language *lang, const unsigned char *buff) } } } + lua_pop(L, 1); } } @@ -627,44 +628,6 @@ static char *tex_aux_hyphenation_exception(int exceptions, char *w) return ret; } -/*tex Kept as reference: */ - -/* -char *get_exception_strings(struct tex_language *lang) -{ - char *ret = NULL; - if (lang && lang->exceptions) { - lua_State *L = lua_state.lua_instance; - if (lua_rawgeti(L, LUA_REGISTRYINDEX, lang->exceptions) == LUA_TTABLE) { - size_t size = 0; - size_t current = 0; - lua_pushnil(L); - while (lua_next(L, -2)) { - size_t l = 0; - const char *value = lua_tolstring(L, -1, &l); - if (current + l + 2 > size) { - size_t new = (size + size/5) + current + l + 1024; - char *tmp = lmt_memory_realloc(ret, new); - if (tmp) { - ret = tmp; - size = new; - } else { - overflow_error("exceptions", (int) size); - } - } - if (ret) { - ret[current] = ' '; - strcpy(&ret[current + 1], value); - current += l + 1; - } - lua_pop(L, 1); - } - } - } - return ret; -} -*/ - /*tex The sequence from |wordstart| to |r| can contain only normal characters it could be faster to @@ -997,8 +960,6 @@ static void tex_aux_do_exception(halfword wordstart, halfword r, char *replaceme */ -// # define is_hyphen_char(chr) (get_hc_code(chr) || chr == ex_hyphen_char_par) - inline static halfword tex_aux_is_hyphen_char(halfword chr) { if (tex_get_hc_code(chr)) { @@ -1013,7 +974,6 @@ inline static halfword tex_aux_is_hyphen_char(halfword chr) static halfword tex_aux_find_next_wordstart(halfword r, halfword first_language) { int start_ok = 1; - int mathlevel = 1; halfword lastglyph = r; while (r) { switch (node_type(r)) { @@ -1038,15 +998,18 @@ static halfword tex_aux_find_next_wordstart(halfword r, halfword first_language) start_ok = 1; break; case math_node: - while (mathlevel > 0) { - r = node_next(r); - if (! r) { - return r; - } else if (node_type(r) == math_node) { - if (node_subtype(r) == begin_inline_math) { - mathlevel++; - } else { - mathlevel--; + if (node_subtype(r) == begin_inline_math) { + int mathlevel = 1; + while (mathlevel > 0) { + r = node_next(r); + if (! r) { + return r; + } else if (node_type(r) == math_node) { + if (node_subtype(r) == begin_inline_math) { + mathlevel++; + } else { + mathlevel--; + } } } } |