text is working both ways

This commit is contained in:
Neil 2023-05-09 14:06:20 -07:00
parent 98c8f8dfc7
commit e87f25c9ee
1 changed files with 7 additions and 9 deletions

View File

@ -817,28 +817,26 @@ static int scan_day(struct scan *const scan, union date32 date,
/* fixme: This is a cool way of doing things. Avoid repetition, make /* fixme: This is a cool way of doing things. Avoid repetition, make
all the things this way. */ all the things this way. */
/* Text is only at the end of a line. */
<input_text, input_text_multi> * { fail = "text input"; goto catch; } <input_text, input_text_multi> * { fail = "text input"; goto catch; }
<input_text> ws { fprintf(stderr, "text space\n"); continue; } <input_text> ws { continue; }
<input_text> "<<\n" @s0 => input_text_multi { // multi-line <input_text> "<<\n" @s0 => input_text_multi { // multi-line
line++;
input.pair->a = s0; input.pair->a = s0;
line++;
continue; continue;
} }
<input_text> @s0 anylabel @s1 / "\n" /*future*/ { // one line <input_text> @s0 anylabel? @s1 "\n" => line { // one line; last one
line++;
fprintf(stderr, "text: <<%.*s>>\n", (int)(s1 - s0), s0); fprintf(stderr, "text: <<%.*s>>\n", (int)(s1 - s0), s0);
input.pair->a = s0, input.pair->b = s1; input.pair->a = s0, input.pair->b = s1;
assert(input.future == yycnewline); if(input.future != yycnewline)
condition = input.future; { fail = "use <<text>>"; goto catch; }
assert(1); line++;
continue; continue;
} }
<input_text_multi> [^\x00\n] { continue; } <input_text_multi> [^\x00\n] { continue; }
<input_text_multi> [\x00] <input_text_multi> [\x00]
{ fail = "missing closing \">>\""; goto catch; } { fail = "missing closing \">>\""; goto catch; }
<input_text_multi> "\n" { line++; continue; } <input_text_multi> "\n" { line++; continue; }
<input_text_multi> @s1 ">>" /*future*/ { <input_text_multi> @s1 ">>" / [^>] /*future*/ {
fprintf(stderr, "text: <<\n%.*s>>\n", fprintf(stderr, "text: <<\n%.*s>>\n",
(int)(s1 - input.pair->a), input.pair->a); (int)(s1 - input.pair->a), input.pair->a);
input.pair->b = s1; input.pair->b = s1;