This commit is contained in:
Neil 2022-02-11 02:00:14 -08:00
parent 39b6e01243
commit b2fd18ad1c

View File

@ -36,7 +36,7 @@ static int looks_like_year(const char *const a, int *const year) {
/* This defines `enum condition`. */
/*!types:re2c*/
enum symbol { END, TEXT, BANG, WHITE, MAP };
enum symbol { END, TEXT, BANG, BRACKET, WHITE, MAP };
/** scanner reads a file and extracts semantic information. Valid to access
only while underlying pointers do not change. */
@ -89,6 +89,8 @@ scan:
return s->symbol = TEXT, 1; }
<text> @s0 "!" @s1 { s->s0 = s0, s->s1 = s1;
return s->symbol = BANG, 1; }
<text> "\\" @s0 "[" @s1 { s->s0 = s0, s->s1 = s1;
return s->symbol = BRACKET, 1; }
<text> "![" :=> image
<text> "[" :=> command
<image> * { return 0; }