end -> sentinel

This commit is contained in:
Neil 2022-02-15 14:03:02 -08:00
parent 3dd4557438
commit 2caa6f458b
1 changed files with 5 additions and 4 deletions

View File

@ -133,15 +133,15 @@ int lex_next(struct lex *const x) {
x->s0 = x->s1 = 0;
scan:
/*!re2c
end = "\x00";
sentinel = "\x00";
illegal = [\x01-\x08\x0a-\x1f\x7f]; // unix-style control characters
newline = "\n";
ws = [ \t];
glyph = [^\x00-\x1f \x7f];
<*> illegal { return x->symbol = ILLEGAL, 0; }
<line> end { return x->symbol = END, 0; }
<line> sentinel { return x->symbol = END, 0; }
<text, text, image, edict, edict_keyword, edict_date, edict_freeform, edict_end>
end { return x->symbol = ILLEGAL, 0; }
sentinel { return x->symbol = ILLEGAL, 0; }
<line> newline { x->line = ++scan.line; return x->symbol = PARAGRAPH, 1; }
<line> "![" :=> image
<line> "[" :=> edict
@ -162,10 +162,11 @@ scan:
}
<image> * { printf("image(broken)\n");return 0; }
//
natural = [1-9][0-9]*;
id = [a-zA-Z_][a-zA-Z_\-0-9]{0,63};
date = "-"? natural "-" [0-1][0-9] "-" [0-1][0-9];
// source
<edict> "source"
{ if(scan.is_ws_expected || scan.edict.size)
return x->symbol = SYNTAX, 0;