Hmmm, not really that great with newlines.

This commit is contained in:
Neil 2023-05-09 01:21:13 -07:00
parent 828c2b6595
commit 98c8f8dfc7
1 changed files with 5 additions and 13 deletions

View File

@ -819,34 +819,26 @@ static int scan_day(struct scan *const scan, union date32 date,
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> ws { continue; }
/* Hmmm.
<input_text> "\n" { // empty is okay
line++;
fprintf(stderr, "text: <empty>\n");
assert(input_text);
input.pair->a = input.pair->b = 0;
condition = input.future;
continue;
} */
<input_text> ws { fprintf(stderr, "text space\n"); continue; }
<input_text> "<<\n" @s0 => input_text_multi { // multi-line
line++;
input.pair->a = s0;
continue;
}
<input_text> @s0 anylabel @s1 /*future*/ { // one line
<input_text> @s0 anylabel @s1 / "\n" /*future*/ { // one line
line++;
fprintf(stderr, "text: <<%.*s>>\n", (int)(s1 - s0), s0);
input.pair->a = s0, input.pair->b = s1;
assert(input.future == yycnewline);
condition = input.future;
assert(1);
continue;
}
<input_text_multi> [^\x00\n] { continue; }
<input_text_multi> [\x00]
{ fail = "missing closing \">>\""; goto catch; }
<input_text_multi> "\n" { line++; continue; }
<input_text_multi> @s1 ">>" {
line++;
<input_text_multi> @s1 ">>" /*future*/ {
fprintf(stderr, "text: <<\n%.*s>>\n",
(int)(s1 - input.pair->a), input.pair->a);
input.pair->b = s1;