maps, significant.
This commit is contained in:
parent
a1be205862
commit
794dc2206f
@ -6,7 +6,7 @@ int lex_looks_like_day(const char *);
|
||||
|
||||
#define LEX_SYMBOL X(END), X(ERROR), X(TEXT), X(BANG), X(BRACKET), X(WHITE), \
|
||||
X(MAP), \
|
||||
/* Commands */ X(DEFAULT), X(SOURCE)
|
||||
/* Commands */ X(SIGNIFICANT), X(DEFAULT), X(SOURCE)
|
||||
|
||||
#define X(n) n
|
||||
struct lex {
|
||||
|
@ -105,8 +105,8 @@ glyph = [^ \t\n\r\v\f![\x00];
|
||||
glyphs = glyph+;
|
||||
|
||||
// inside the block
|
||||
decimal = [1-9][0-9]*;
|
||||
number = ([1-9][0-9]* | [0])? "." [0-9]+ | [1-9][0-9]* | [0];
|
||||
natural = [1-9][0-9]*;
|
||||
decimal = "-"? ([1-9][0-9]* | [0])? "." [0-9]+ | [1-9][0-9]* | [0];
|
||||
id = [a-zA-Z_][a-zA-Z_\-0-9]{0,63};
|
||||
*/
|
||||
|
||||
@ -140,15 +140,18 @@ scan:
|
||||
<text> "" {
|
||||
scan.condition = yyctext;
|
||||
x->s0 = s0, x->s1 = s1;
|
||||
<image> ws* "osm" ws* "](geo:" @s0 decimal "," @s1 decimal ")" => text {
|
||||
x->symbol = MAP, x->s0 = s0, x->s1 = s1;
|
||||
printf("Got a map.\n");
|
||||
return 1;
|
||||
}
|
||||
<image> * { printf("image(broken)\n");return 0; }
|
||||
|
||||
<command> ws+ { scan.is_ws_expected = 0; goto scan; }
|
||||
<command> @s0 natural @s1
|
||||
{ if(scan.is_ws_expected) return x->symbol = ERROR, 0;
|
||||
return x->symbol = SIGNIFICANT, scan.is_ws_expected = 1,
|
||||
x->s0 = s0, x->s1 = s1, 1; }
|
||||
<command> "source"
|
||||
{ if(scan.is_ws_expected) return x->symbol = ERROR, 0;
|
||||
return scan.is_ws_expected = 1, x->symbol = SOURCE, 1; }
|
||||
@ -157,7 +160,7 @@ scan:
|
||||
return scan.is_ws_expected = 1, x->symbol = DEFAULT, 1; }
|
||||
<command> ":" => command_args { scan.is_ws_expected = 0; goto scan; }
|
||||
<command_args> [^\n\r\]\x00]+ { printf("Command args fixme\n"); goto scan; }
|
||||
<command_args> "]" :=> text
|
||||
<command, command_args> "]" :=> text
|
||||
<command, command_args> * { return x->symbol = ERROR, 0; }
|
||||
*/
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user