Debian Codegraph @

texk/web2c/luatexdir/lua/luatoken.c

raw
1 /*
2
3 luatoken.w
4
5 Copyright 2006-2012 Taco Hoekwater <taco@@luatex.org>
6
7 This file is part of LuaTeX.
8
9 LuaTeX is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your
12 option) any later version.
13
14 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 License for more details.
18
19 You should have received a copy of the GNU General Public License along
20 with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
21
22 */
23
24 #include "ptexlib.h"
25 #include "lua/luatex-api.h"
26
27 command_item command_names[] = {
28 { relax_cmd, NULL, 0},
29 { left_brace_cmd, NULL, 0},
30 { right_brace_cmd, NULL, 0},
31 { math_shift_cmd, NULL, 0},
32 { tab_mark_cmd, NULL, 0},
33 { car_ret_cmd, NULL, 0},
34 { mac_param_cmd, NULL, 0},
35 { sup_mark_cmd, NULL, 0},
36 { sub_mark_cmd, NULL, 0},
37 { endv_cmd, NULL, 0},
38 { spacer_cmd, NULL, 0},
39 { letter_cmd, NULL, 0},
40 { other_char_cmd, NULL, 0},
41 { par_end_cmd, NULL, 0},
42 { stop_cmd, NULL, 0},
43 { delim_num_cmd, NULL, 0},
44 { char_num_cmd, NULL, 0},
45 { math_char_num_cmd, NULL, 0},
46 { mark_cmd, NULL, 0},
47 { node_cmd, NULL, 0},
48 { xray_cmd, NULL, 0},
49 { make_box_cmd, NULL, 0},
50 { hmove_cmd, NULL, 0},
51 { vmove_cmd, NULL, 0},
52 { un_hbox_cmd, NULL, 0},
53 { un_vbox_cmd, NULL, 0},
54 { remove_item_cmd, NULL, 0},
55 { hskip_cmd, NULL, 0},
56 { vskip_cmd, NULL, 0},
57 { mskip_cmd, NULL, 0},
58 { kern_cmd, NULL, 0},
59 { mkern_cmd, NULL, 0},
60 { leader_ship_cmd, NULL, 0},
61 { halign_cmd, NULL, 0},
62 { valign_cmd, NULL, 0},
63 { no_align_cmd, NULL, 0},
64 { no_vrule_cmd, NULL, 0},
65 { no_hrule_cmd, NULL, 0},
66 { vrule_cmd, NULL, 0},
67 { hrule_cmd, NULL, 0},
68 { insert_cmd, NULL, 0},
69 { vadjust_cmd, NULL, 0},
70 { ignore_spaces_cmd, NULL, 0},
71 { after_assignment_cmd, NULL, 0},
72 { after_group_cmd, NULL, 0},
73 { partoken_name_cmd, NULL, 0},
74 { break_penalty_cmd, NULL, 0},
75 { start_par_cmd, NULL, 0},
76 { ital_corr_cmd, NULL, 0},
77 { accent_cmd, NULL, 0},
78 { math_accent_cmd, NULL, 0},
79 { discretionary_cmd, NULL, 0},
80 { eq_no_cmd, NULL, 0},
81 { left_right_cmd, NULL, 0},
82 { math_comp_cmd, NULL, 0},
83 { limit_switch_cmd, NULL, 0},
84 { above_cmd, NULL, 0},
85 { math_style_cmd, NULL, 0},
86 { math_choice_cmd, NULL, 0},
87 { non_script_cmd, NULL, 0},
88 { vcenter_cmd, NULL, 0},
89 { case_shift_cmd, NULL, 0},
90 { message_cmd, NULL, 0},
91 { normal_cmd, NULL, 0},
92 { extension_cmd, NULL, 0},
93 { option_cmd, NULL, 0},
94 { lua_function_call_cmd, NULL, 0},
95 { lua_bytecode_call_cmd, NULL, 0},
96 { lua_call_cmd, NULL, 0},
97 { in_stream_cmd, NULL, 0},
98 { begin_group_cmd, NULL, 0},
99 { end_group_cmd, NULL, 0},
100 { omit_cmd, NULL, 0},
101 { ex_space_cmd, NULL, 0},
102 { boundary_cmd, NULL, 0},
103 { radical_cmd, NULL, 0},
104 { super_sub_script_cmd, NULL, 0},
105 { no_super_sub_script_cmd, NULL, 0},
106 { math_shift_cs_cmd, NULL, 0},
107 { end_cs_name_cmd, NULL, 0},
108 { char_ghost_cmd, NULL, 0},
109 { assign_local_box_cmd, NULL, 0},
110 { char_given_cmd, NULL, 0},
111 { math_given_cmd, NULL, 0},
112 { xmath_given_cmd, NULL, 0},
113 { last_item_cmd, NULL, 0},
114 { toks_register_cmd, NULL, 0},
115 { assign_toks_cmd, NULL, 0},
116 { assign_int_cmd, NULL, 0},
117 { assign_attr_cmd, NULL, 0},
118 { assign_dimen_cmd, NULL, 0},
119 { assign_glue_cmd, NULL, 0},
120 { assign_mu_glue_cmd, NULL, 0},
121 { assign_font_dimen_cmd, NULL, 0},
122 { assign_font_int_cmd, NULL, 0},
123 { assign_hang_indent_cmd, NULL, 0},
124 { set_aux_cmd, NULL, 0},
125 { set_prev_graf_cmd, NULL, 0},
126 { set_page_dimen_cmd, NULL, 0},
127 { set_page_int_cmd, NULL, 0},
128 { set_box_dimen_cmd, NULL, 0},
129 { set_tex_shape_cmd, NULL, 0},
130 { set_etex_shape_cmd, NULL, 0},
131 { def_char_code_cmd, NULL, 0},
132 { def_del_code_cmd, NULL, 0},
133 { extdef_math_code_cmd, NULL, 0},
134 { extdef_del_code_cmd, NULL, 0},
135 { def_family_cmd, NULL, 0},
136 { set_math_param_cmd, NULL, 0},
137 { set_font_cmd, NULL, 0},
138 { def_font_cmd, NULL, 0},
139 { register_cmd, NULL, 0},
140 { assign_box_direction_cmd, NULL, 0},
141 { assign_box_dir_cmd, NULL, 0},
142 { assign_direction_cmd, NULL, 0},
143 { assign_dir_cmd, NULL, 0},
144 { combine_toks_cmd, NULL, 0},
145 { advance_cmd, NULL, 0},
146 { multiply_cmd, NULL, 0},
147 { divide_cmd, NULL, 0},
148 { prefix_cmd, NULL, 0},
149 { let_cmd, NULL, 0},
150 { shorthand_def_cmd, NULL, 0},
151 { def_lua_call_cmd, NULL, 0},
152 { read_to_cs_cmd, NULL, 0},
153 { def_cmd, NULL, 0},
154 { set_box_cmd, NULL, 0},
155 { hyph_data_cmd, NULL, 0},
156 { set_interaction_cmd, NULL, 0},
157 { letterspace_font_cmd, NULL, 0},
158 { expand_font_cmd, NULL, 0},
159 { copy_font_cmd, NULL, 0},
160 { set_font_id_cmd, NULL, 0},
161 { undefined_cs_cmd, NULL, 0},
162 { expand_after_cmd, NULL, 0},
163 { no_expand_cmd, NULL, 0},
164 { input_cmd, NULL, 0},
165 { lua_expandable_call_cmd, NULL, 0},
166 { lua_local_call_cmd, NULL, 0},
167 { if_test_cmd, NULL, 0},
168 { fi_or_else_cmd, NULL, 0},
169 { cs_name_cmd, NULL, 0},
170 { convert_cmd, NULL, 0},
171 { variable_cmd, NULL, 0},
172 { feedback_cmd, NULL, 0},
173 { the_cmd, NULL, 0},
174 { top_bot_mark_cmd, NULL, 0},
175 { call_cmd, NULL, 0},
176 { long_call_cmd, NULL, 0},
177 { outer_call_cmd, NULL, 0},
178 { long_outer_call_cmd, NULL, 0},
179 { end_template_cmd, NULL, 0},
180 { dont_expand_cmd, NULL, 0},
181 { glue_ref_cmd, NULL, 0},
182 { shape_ref_cmd, NULL, 0},
183 { box_ref_cmd, NULL, 0},
184 { data_cmd, NULL, 0},
185 { -1, NULL, 0}
186 };
187
188 # define init_token_key(target,n,key) \
189 target[n].lua = luaS_##key##_index; \
190 target[n].name = luaS_##key##_ptr;
191
192 void l_set_token_data(void)
193 {
194 init_token_key(command_names, relax_cmd, relax);
195 init_token_key(command_names, left_brace_cmd, left_brace);
196 init_token_key(command_names, right_brace_cmd, right_brace);
197 init_token_key(command_names, math_shift_cmd, math_shift);
198 init_token_key(command_names, tab_mark_cmd, tab_mark);
199 init_token_key(command_names, car_ret_cmd, car_ret);
200 init_token_key(command_names, mac_param_cmd, mac_param);
201 init_token_key(command_names, sup_mark_cmd, sup_mark);
202 init_token_key(command_names, sub_mark_cmd, sub_mark);
203 init_token_key(command_names, endv_cmd, endv);
204 init_token_key(command_names, spacer_cmd, spacer);
205 init_token_key(command_names, letter_cmd, letter);
206 init_token_key(command_names, other_char_cmd, other_char);
207 init_token_key(command_names, par_end_cmd, par_end);
208 init_token_key(command_names, stop_cmd, stop);
209 init_token_key(command_names, delim_num_cmd, delim_num);
210 init_token_key(command_names, char_num_cmd, char_num);
211 init_token_key(command_names, math_char_num_cmd, math_char_num);
212 init_token_key(command_names, mark_cmd, mark);
213 init_token_key(command_names, node_cmd, node);
214 init_token_key(command_names, xray_cmd, xray);
215 init_token_key(command_names, make_box_cmd, make_box);
216 init_token_key(command_names, hmove_cmd, hmove);
217 init_token_key(command_names, vmove_cmd, vmove);
218 init_token_key(command_names, un_hbox_cmd, un_hbox);
219 init_token_key(command_names, un_vbox_cmd, un_vbox);
220 init_token_key(command_names, remove_item_cmd, remove_item);
221 init_token_key(command_names, hskip_cmd, hskip);
222 init_token_key(command_names, vskip_cmd, vskip);
223 init_token_key(command_names, mskip_cmd, mskip);
224 init_token_key(command_names, kern_cmd, kern);
225 init_token_key(command_names, mkern_cmd, mkern);
226 init_token_key(command_names, leader_ship_cmd, leader_ship);
227 init_token_key(command_names, halign_cmd, halign);
228 init_token_key(command_names, valign_cmd, valign);
229 init_token_key(command_names, no_align_cmd, no_align);
230 init_token_key(command_names, vrule_cmd, vrule);
231 init_token_key(command_names, hrule_cmd, hrule);
232 init_token_key(command_names, no_vrule_cmd, novrule);
233 init_token_key(command_names, no_hrule_cmd, nohrule);
234 init_token_key(command_names, insert_cmd, insert);
235 init_token_key(command_names, vadjust_cmd, vadjust);
236 init_token_key(command_names, ignore_spaces_cmd, ignore_spaces);
237 init_token_key(command_names, after_assignment_cmd, after_assignment);
238 init_token_key(command_names, after_group_cmd, after_group);
239 init_token_key(command_names, partoken_name_cmd, partoken_name);
240 init_token_key(command_names, break_penalty_cmd, break_penalty);
241 init_token_key(command_names, start_par_cmd, start_par);
242 init_token_key(command_names, ital_corr_cmd, ital_corr);
243 init_token_key(command_names, accent_cmd, accent);
244 init_token_key(command_names, math_accent_cmd, math_accent);
245 init_token_key(command_names, discretionary_cmd, discretionary);
246 init_token_key(command_names, eq_no_cmd, eq_no);
247 init_token_key(command_names, left_right_cmd, left_right);
248 init_token_key(command_names, math_comp_cmd, math_comp);
249 init_token_key(command_names, limit_switch_cmd, limit_switch);
250 init_token_key(command_names, above_cmd, above);
251 init_token_key(command_names, math_style_cmd, math_style);
252 init_token_key(command_names, math_choice_cmd, math_choice);
253 init_token_key(command_names, non_script_cmd, non_script);
254 init_token_key(command_names, vcenter_cmd, vcenter);
255 init_token_key(command_names, case_shift_cmd, case_shift);
256 init_token_key(command_names, message_cmd, message);
257 init_token_key(command_names, normal_cmd, normal);
258 init_token_key(command_names, extension_cmd, extension);
259 init_token_key(command_names, option_cmd, option);
260 init_token_key(command_names, lua_function_call_cmd, lua_function_call);
261 init_token_key(command_names, lua_bytecode_call_cmd, lua_bytecode_call);
262 init_token_key(command_names, lua_call_cmd, lua_call);
263 init_token_key(command_names, in_stream_cmd, in_stream);
264 init_token_key(command_names, begin_group_cmd, begin_group);
265 init_token_key(command_names, end_group_cmd, end_group);
266 init_token_key(command_names, omit_cmd, omit);
267 init_token_key(command_names, ex_space_cmd, ex_space);
268 init_token_key(command_names, boundary_cmd, boundary);
269 init_token_key(command_names, radical_cmd, radical);
270 init_token_key(command_names, super_sub_script_cmd, super_sub_script);
271 init_token_key(command_names, no_super_sub_script_cmd, no_super_sub_script);
272 init_token_key(command_names, math_shift_cs_cmd, math_shift_cs);
273 init_token_key(command_names, end_cs_name_cmd, end_cs_name);
274 init_token_key(command_names, char_ghost_cmd, char_ghost);
275 init_token_key(command_names, assign_local_box_cmd, assign_local_box);
276 init_token_key(command_names, char_given_cmd, char_given);
277 init_token_key(command_names, math_given_cmd, math_given);
278 init_token_key(command_names, xmath_given_cmd, xmath_given);
279 init_token_key(command_names, last_item_cmd, last_item);
280 init_token_key(command_names, toks_register_cmd, toks_register);
281 init_token_key(command_names, assign_toks_cmd, assign_toks);
282 init_token_key(command_names, assign_int_cmd, assign_int);
283 init_token_key(command_names, assign_attr_cmd, assign_attr);
284 init_token_key(command_names, assign_dimen_cmd, assign_dimen);
285 init_token_key(command_names, assign_glue_cmd, assign_glue);
286 init_token_key(command_names, assign_mu_glue_cmd, assign_mu_glue);
287 init_token_key(command_names, assign_font_dimen_cmd, assign_font_dimen);
288 init_token_key(command_names, assign_font_int_cmd, assign_font_int);
289 init_token_key(command_names, assign_hang_indent_cmd, assign_hang_indent);
290 init_token_key(command_names, set_aux_cmd, set_aux);
291 init_token_key(command_names, set_prev_graf_cmd, set_prev_graf);
292 init_token_key(command_names, set_page_dimen_cmd, set_page_dimen);
293 init_token_key(command_names, set_page_int_cmd, set_page_int);
294 init_token_key(command_names, set_box_dimen_cmd, set_box_dimen);
295 init_token_key(command_names, set_tex_shape_cmd, set_tex_shape);
296 init_token_key(command_names, set_etex_shape_cmd, set_etex_shape);
297 init_token_key(command_names, def_char_code_cmd, def_char_code);
298 init_token_key(command_names, def_del_code_cmd, def_del_code);
299 init_token_key(command_names, extdef_math_code_cmd, extdef_math_code);
300 init_token_key(command_names, extdef_del_code_cmd, extdef_del_code);
301 init_token_key(command_names, def_family_cmd, def_family);
302 init_token_key(command_names, set_math_param_cmd, set_math_param);
303 init_token_key(command_names, set_font_cmd, set_font);
304 init_token_key(command_names, def_font_cmd, def_font);
305 init_token_key(command_names, def_lua_call_cmd, def_lua_call);
306 init_token_key(command_names, register_cmd, register);
307 init_token_key(command_names, assign_box_direction_cmd, assign_box_direction);
308 init_token_key(command_names, assign_box_dir_cmd, assign_box_dir);
309 init_token_key(command_names, assign_direction_cmd, assign_direction);
310 init_token_key(command_names, assign_dir_cmd, assign_dir);
311 init_token_key(command_names, combine_toks_cmd, combinetoks);
312 init_token_key(command_names, advance_cmd, advance);
313 init_token_key(command_names, multiply_cmd, multiply);
314 init_token_key(command_names, divide_cmd, divide);
315 init_token_key(command_names, prefix_cmd, prefix);
316 init_token_key(command_names, let_cmd, let);
317 init_token_key(command_names, shorthand_def_cmd, shorthand_def);
318 init_token_key(command_names, read_to_cs_cmd, read_to_cs);
319 init_token_key(command_names, def_cmd, def);
320 init_token_key(command_names, set_box_cmd, set_box);
321 init_token_key(command_names, hyph_data_cmd, hyph_data);
322 init_token_key(command_names, set_interaction_cmd, set_interaction);
323 init_token_key(command_names, letterspace_font_cmd, letterspace_font);
324 init_token_key(command_names, expand_font_cmd, expand_font);
325 init_token_key(command_names, copy_font_cmd, copy_font);
326 init_token_key(command_names, set_font_id_cmd, set_font_id);
327 init_token_key(command_names, undefined_cs_cmd, undefined_cs);
328 init_token_key(command_names, expand_after_cmd, expand_after);
329 init_token_key(command_names, no_expand_cmd, no_expand);
330 init_token_key(command_names, input_cmd, input);
331 init_token_key(command_names, lua_expandable_call_cmd, lua_expandable_call);
332 init_token_key(command_names, lua_local_call_cmd, lua_local_call);
333 init_token_key(command_names, if_test_cmd, if_test);
334 init_token_key(command_names, fi_or_else_cmd, fi_or_else);
335 init_token_key(command_names, cs_name_cmd, cs_name);
336 init_token_key(command_names, convert_cmd, convert);
337 init_token_key(command_names, variable_cmd, variable);
338 init_token_key(command_names, feedback_cmd, feedback);
339 init_token_key(command_names, the_cmd, the);
340 init_token_key(command_names, top_bot_mark_cmd, top_bot_mark);
341 init_token_key(command_names, call_cmd, call);
342 init_token_key(command_names, long_call_cmd, long_call);
343 init_token_key(command_names, outer_call_cmd, outer_call);
344 init_token_key(command_names, long_outer_call_cmd, long_outer_call);
345 init_token_key(command_names, end_template_cmd, end_template);
346 init_token_key(command_names, dont_expand_cmd, dont_expand);
347 init_token_key(command_names, glue_ref_cmd, glue_ref);
348 init_token_key(command_names, shape_ref_cmd, shape_ref);
349 init_token_key(command_names, box_ref_cmd, box_ref);
350 init_token_key(command_names, data_cmd, data);
351 }
352
353 int get_command_id(const char *s)
354 {
355 int i;
356 for (i = 0; command_names[i].id != -1; i++) {
357 if (s == command_names[i].name)
358 return i;
359 }
360 return -1;
361 }
362
363 /*
364 static int get_cur_cmd(lua_State * L)
365 {
366 int r = 0;
367 size_t len = lua_rawlen(L, -1);
368 cur_cs = 0;
369 if (len == 3 || len == 2) {
370 r = 1;
371 lua_rawgeti(L, -1, 1);
372 cur_cmd = (int) lua_tointeger(L, -1);
373 lua_rawgeti(L, -2, 2);
374 cur_chr = (halfword) lua_tointeger(L, -1);
375 if (len == 3) {
376 lua_rawgeti(L, -3, 3);
377 cur_cs = (halfword) lua_tointeger(L, -1);
378 }
379 lua_pop(L, (int) len);
380 if (cur_cs == 0)
381 cur_tok = token_val(cur_cmd, cur_chr);
382 else
383 cur_tok = cs_token_flag + cur_cs;
384 }
385 return r;
386 }
387 */
388
389 /*
390 static int get_cur_cs(lua_State * L)
391 {
392 const char *s;
393 unsigned j;
394 size_t l;
395 int cs;
396 int save_nncs;
397 int ret;
398 ret = 0;
399 cur_cs = 0;
400 lua_getfield(L, -1, "name");
401 if (lua_type(L, -1) == LUA_TSTRING) {
402 s = lua_tolstring(L, -1, &l);
403 if (l > 0) {
404 if ((last + (int) l) > buf_size)
405 check_buffer_overflow((last + (int) l));
406 for (j = 0; j < l; j++) {
407 buffer[(unsigned) last + 1 + j] = (packed_ASCII_code) * s++;
408 }
409 save_nncs = no_new_control_sequence;
410 no_new_control_sequence = false;
411 cs = id_lookup((last + 1), (int) l);
412 cur_tok = cs_token_flag + cs;
413 cur_cmd = eq_type(cs);
414 cur_chr = equiv(cs);
415 no_new_control_sequence = save_nncs;
416 ret = 1;
417 }
418 }
419 lua_pop(L, 1);
420 return ret;
421 }
422 */
423
424 void tokenlist_to_lua(lua_State * L, int p)
425 {
426 int cmd, chr, cs;
427 int v;
428 int i = 1;
429 v = p;
430 while (v != null && v < (int) fix_mem_end) {
431 i++;
432 v = token_link(v);
433 }
434 i = 1;
435 lua_createtable(L, i, 0);
436 while (p != null && p < (int) fix_mem_end) {
437 if (token_info(p) >= cs_token_flag) {
438 cs = token_info(p) - cs_token_flag;
439 cmd = eq_type(cs);
440 chr = equiv(cs);
441 make_token_table(L, cmd, chr, cs);
442 } else {
443 cmd = token_cmd(token_info(p));
444 chr = token_chr(token_info(p));
445 make_token_table(L, cmd, chr, 0);
446 }
447 lua_rawseti(L, -2, i++);
448 p = token_link(p);
449 }
450 }
451
452 void tokenlist_to_luastring(lua_State * L, int p)
453 {
454 int l;
455 char *s;
456 s = tokenlist_to_cstring(p, 1, &l);
457 lua_pushlstring(L, s, (size_t) l);
458 free(s);
459 }
460
461 int tokenlist_from_lua(lua_State * L, int index)
462 {
463 const char *s;
464 int tok, t;
465 size_t i, j;
466 halfword p, q, r;
467 r = get_avail();
468 token_info(r) = 0;
469 token_link(r) = null;
470 p = r;
471 t = lua_type(L, index);
472 if (t == LUA_TTABLE) {
473 j = lua_rawlen(L, index);
474 if (j > 0) {
475 for (i = 1; i <= j; i++) {
476 lua_rawgeti(L, index, (int) i);
477 tok = token_from_lua(L);
478 if (tok >= 0) {
479 store_new_token(tok);
480 }
481 lua_pop(L, 1);
482 };
483 }
484 return r;
485 } else if (t == LUA_TSTRING) {
486 s = lua_tolstring(L, index, &j);
487 for (i = 0; i < j; i++) {
488 if (s[i] == 32) {
489 tok = token_val(10, s[i]);
490 } else {
491 int j1 = (int) str2uni((const unsigned char *) (s + i));
492 i = i + (size_t) (utf8_size(j1) - 1);
493 tok = token_val(12, j1);
494 }
495 store_new_token(tok);
496 }
497 return r;
498 } else {
499 free_avail(r);
500 return null;
501 }
502 }
503
504 /*
505 static void do_get_token_lua(int callback_id)
506 {
507 while (1) {
508 if (!get_callback(Luas, callback_id)) {
509 get_next();
510 lua_pop(Luas, 2);
511 break;
512 }
513 if (lua_pcall(Luas, 0, 1, 0) != 0) {
514 tex_error(lua_tostring(Luas, -1), NULL);
515 lua_pop(Luas, 2);
516 break;
517 }
518 if (lua_istable(Luas, -1)) {
519 lua_rawgeti(Luas, -1, 1);
520 if (lua_istable(Luas, -1)) {
521 int p, q, r;
522 size_t i, j;
523 lua_pop(Luas, 1);
524 r = get_avail();
525 p = r;
526 j = lua_rawlen(Luas, -1);
527 if (j > 0) {
528 for (i = 1; i <= j; i++) {
529 lua_rawgeti(Luas, -1, (int) i);
530 if (get_cur_cmd(Luas) || get_cur_cs(Luas)) {
531 store_new_token(cur_tok);
532 }
533 lua_pop(Luas, 1);
534 }
535 }
536 if (p != r) {
537 p = token_link(r);
538 free_avail(r);
539 begin_token_list(p, inserted);
540 cur_input.nofilter_field = true;
541 get_next();
542 } else {
543 tex_error("error: illegal or empty token list returned", NULL);
544 }
545 lua_pop(Luas, 2);
546 break;
547 } else {
548 lua_pop(Luas, 1);
549 if (get_cur_cmd(Luas) || get_cur_cs(Luas)) {
550 lua_pop(Luas, 2);
551 break;
552 } else {
553 lua_pop(Luas, 2);
554 continue;
555 }
556 }
557 } else {
558 lua_pop(Luas, 2);
559 }
560 }
561 return;
562 }
563 */