summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/tex/expand.w
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-12-16 14:50:11 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-12-16 14:50:11 +0000
commit621273b5ef8cc9e83d9aca07bf012f727ba26f15 (patch)
tree0b5cb28eec37e3e0e93a09729cbc30834166a5f9 /Build/source/texk/web2c/luatexdir/tex/expand.w
parentf04f01782aebac8cb2fcde278c02a4fb3be4bb12 (diff)
web2c/luatexdir: LuaTeX beta-0.86.0 (Sync with the upstream).
git-svn-id: svn://tug.org/texlive/trunk@39116 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex/expand.w')
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/expand.w76
1 files changed, 57 insertions, 19 deletions
diff --git a/Build/source/texk/web2c/luatexdir/tex/expand.w b/Build/source/texk/web2c/luatexdir/tex/expand.w
index 098b6808373..46c8622b491 100644
--- a/Build/source/texk/web2c/luatexdir/tex/expand.w
+++ b/Build/source/texk/web2c/luatexdir/tex/expand.w
@@ -221,7 +221,13 @@ void expand(void)
break;
case cs_name_cmd:
/* Manufacture a control sequence name; */
- manufacture_csname();
+ if (cur_chr == 0) {
+ manufacture_csname(0);
+ } else if (cur_chr == 1) {
+ inject_last_tested_cs();
+ } else {
+ manufacture_csname(1);
+ }
break;
case convert_cmd:
conv_toks(); /* this procedure is discussed in Part 27 below */
@@ -229,6 +235,9 @@ void expand(void)
case the_cmd:
ins_the_toks(); /* this procedure is discussed in Part 27 below */
break;
+ case combine_toks_cmd:
+ combine_the_toks(cur_chr);
+ break;
case if_test_cmd:
conditional(); /* this procedure is discussed in Part 28 below */
break;
@@ -320,7 +329,7 @@ void complain_missing_csname(void)
}
@ @c
-void manufacture_csname(void)
+void manufacture_csname(boolean use)
{
halfword p, q, r;
lstring *ss;
@@ -339,22 +348,50 @@ void manufacture_csname(void)
/* Look up the characters of list |r| in the hash table, and set |cur_cs| */
ss = tokenlist_to_lstring(r, true);
is_in_csname -= 1;
- if (ss->l > 0) {
- no_new_control_sequence = false;
- cur_cs = string_lookup((char *) ss->s, ss->l);
- no_new_control_sequence = true;
+ if (use) {
+ if (ss->l > 0) {
+ cur_cs = string_lookup((char *) ss->s, ss->l);
+ } else {
+ cur_cs = null_cs;
+ }
+ last_cs_name = cur_cs ;
+ free_lstring(ss);
+ flush_list(r);
+ if (cur_cs == null_cs) {
+ /* skip */
+ } else if (eq_type(cur_cs) == undefined_cs_cmd) {
+ /* skip */
+ } else {
+ cur_tok = cur_cs + cs_token_flag;
+ back_input();
+ }
} else {
- cur_cs = null_cs; /* the list is empty */
+ if (ss->l > 0) {
+ no_new_control_sequence = false;
+ cur_cs = string_lookup((char *) ss->s, ss->l);
+ no_new_control_sequence = true;
+ } else {
+ cur_cs = null_cs; /* the list is empty */
+ }
+ last_cs_name = cur_cs ;
+ free_lstring(ss);
+ flush_list(r);
+ if (eq_type(cur_cs) == undefined_cs_cmd) {
+ eq_define(cur_cs, relax_cmd, too_big_char); /* N.B.: The |save_stack| might change */
+ }; /* the control sequence will now match `\.{\\relax}' */
+ cur_tok = cur_cs + cs_token_flag;
+ back_input();
}
- free_lstring(ss);
- flush_list(r);
- if (eq_type(cur_cs) == undefined_cs_cmd) {
- eq_define(cur_cs, relax_cmd, too_big_char); /* N.B.: The |save_stack| might change */
- }; /* the control sequence will now match `\.{\\relax}' */
- cur_tok = cur_cs + cs_token_flag;
- back_input();
}
+void inject_last_tested_cs(void)
+{
+ if (last_cs_name != null_cs) {
+ cur_cs = last_cs_name;
+ cur_tok = last_cs_name + cs_token_flag;
+ back_input();
+ }
+}
@ Sometimes the expansion looks too far ahead, so we want to insert
a harmless \.{\\relax} into the user's input.
@@ -378,7 +415,7 @@ common cases.
void get_x_token(void)
{ /* sets |cur_cmd|, |cur_chr|, |cur_tok|, and expands macros */
RESTART:
- get_next(); /* get_token_lua(); */
+ get_next();
if (cur_cmd <= max_command_cmd)
goto DONE;
if (cur_cmd >= call_cmd) {
@@ -409,7 +446,7 @@ void x_token(void)
{ /* |get_x_token| without the initial |get_next| */
while (cur_cmd > max_command_cmd) {
expand();
- get_next(); /* get_token_lua(); */
+ get_next();
}
if (cur_cs == 0)
cur_tok = token_val(cur_cmd, cur_chr);
@@ -750,9 +787,10 @@ void macro_call(void)
/* Before we put a new token list on the input stack, it is wise to clean off
all token lists that have recently been depleted. Then a user macro that ends
with a call to itself will not require unbounded stack space. */
- while ((istate == token_list) && (iloc == null)
- && (token_type != v_template))
- end_token_list(); /* conserve stack space */
+ while ((istate == token_list) && (iloc == null) && (token_type != v_template)) {
+ /* conserve stack space */
+ end_token_list();
+ }
begin_token_list(ref_count, macro);
iname = warning_index;
iloc = token_link(r);