Added ->[keyword](geo:dec,dec) for saving and keyword can now start with a number, as long as it has an alpha.

This commit is contained in:
Neil 2022-03-30 15:08:12 -07:00
parent 6524d06c2b
commit bd53cf2ccc
2 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,7 @@ int lex_looks_like_day(const char *);
\
/* Edicts. */ \
X(SOURCE), X(DEFAULT), X(SOURCE_RECALL), \
X(LOCATION), X(LOCATION_RECALL), \
X(LOCATION), X(LOCATION_SAVE), X(LOCATION_RECALL), \
X(SIGNIFICANT), X(SIGNIFICANT_RECALL), \
\
/* Arguments. */ \

View File

@ -134,7 +134,7 @@ int lex_next(struct lex *const x) {
newline = "\n";
ws = [ \t];
glyph = [^] \ (sentinel | illegal | newline | ws);
keyword = [a-zA-Z_][a-zA-Z0-9_\-]{0,63};
keyword = ([a-zA-Z] | [0-9][0-9_\-]*[a-zA-Z]) [a-zA-Z0-9_\-]*;
decimal = "-"? ([1-9][0-9]* | [0])? "." [0-9]+ | [1-9][0-9]* | [0];
natural = [1-9][0-9]*;
date = "-"? natural "-" [0-1][0-9] "-" [0-1][0-9];
@ -170,6 +170,8 @@ scan:
{ x->s0 = s0, x->s1 = s1; return x->symbol = SOURCE_RECALL, 1; }
<location> "" / "(" :=> map
<location> "[" ws* @s0 keyword @s1 ws* "]"
{ x->s0 = s0, x->s1 = s1; return x->symbol = LOCATION_SAVE, 1; }
<location> @s0 keyword @s1 => expect_line
{ x->s0 = s0, x->s1 = s1; return x->symbol = LOCATION_RECALL, 1; }