void\r
pop_cdat(void);\r
void\r
+insert_refid(int);\r
+void\r
insert_link_name(struct name*);\r
void\r
insert_link_namelist(struct name*);\r
/* set cdat idx values for both set and odat */\r
curr_mem_setp->cdat_idx = num_cdats;\r
\r
+ /* TODO: INSERT MAP HEIGHT/WIDTH/NAME/FILEPATH INTO ODAT */\r
+\r
\r
/* Generate refid if needed, put into ref_buf */\r
if(!refid)\r
name_u8_cpy(&curr_modelp->name, model_name);\r
curr_modelp->spritesheet[direction].height = height;\r
curr_modelp->spritesheet[direction].width = width;\r
+ /* TODO: INSERT FILEPATH INTO VDAT */\r
+ u8_stpncpy(curr_modelp->spritesheet[direction].filepath, filepath, FPATH_MAX);\r
\r
name_u8_cpy(last_model_name, model_name);\r
\r
}\r
\r
void\r
-insert_statement\r
+insert_refid\r
( refid )\r
int refid;\r
{ CURR_SS_ODATP()->refid = refid;\r
action push_ref { PUSHTOK(REF, ttov, ref); }
action push_val { PUSHTOK(NUM, ttov, val); }
action push_name { printf("Lexer_lexstring:: action:push_name: from %s to %s\n", ts, p);
- PUSHTOK(NAME, tton, str);
+ PUSHTOK(NAME, tton, name);
}
action push_map { printf("Lexer_lexstring:: action:push_map: pushing '~'\n");
yylval.str = (uint8_t*) '~';
PUSHTOK(WIDTH, ttov, val);
}
action push_link {yylval.str = (uint8_t*) '#'; lexer_pushtok(LINK),yylval); }
- action lex_error { printf("input error: character %c in filename %s is invalid\n p = %s\n", fc, str, p);}
+ #action lex_error { printf("input error: character %c in filename %s is invalid\n p = %s\n", fc, str, p);}
action p { printf("Lexer_lexstring:: p = %s\n", p);}
- # Parses a regular filename (not a mapping) and pushes
- # tokens to the parser
N = 'N' %push_N;
W = 'W' %push_W;
S = 'S' %push_S;
SW = 'SW' %push_SW;
SE = 'SE' %push_SE;
+ #what goes in between tokens in a filename
tok_delimiter = [_];
+
+ #types of tokes a filename can contain
direction = (N | W | S | E | NW | NE | SW | SE) ;
#make sure 0x123123 doesnt get mistaken for a ref
dimensions = (digit+ - '0') >set_ts %push_height 'x' (digit+ - '0') >set_ts %push_width;
val = digit+ >set_ts %push_val ;
name = (lower+ >set_ts) %push_name ;
map = '+MAP' %to(push_map);
- tok = name %to(push_name) ;
+ tok = (name | val | ref | dimensions | map | link | SS | direction);
- tok_lexer := ((name | val | ref | dimensions | map) tok_delimiter)+ tok [\0];
+ tok_lexer := (tok tok_delimiter)+ tok [\0];
write data;
lexer_lexstring
(uint8_t* str, int size)
{ uint8_t *p;
- uint8_t *ts, *pe, *eof;
- int cs, ntok, tok_t, direction;
+ uint8_t *ts, *pe;
+ int cs, ntok, tok_t;
- ntok = direction = 0;
+ ntok = 0;
p = ts = str;
- pe = p + size +1;
+ pe = p + size + 1;
printf("|---Begin lexstring on p = %s, pe = %s.\n",p, pe);
%%write init;
- %%write exec ;
+ %%write exec;
printf("Ending lexstring of file %s, pushed %d tokens.\n",str, ntok);
}
+/**************************/
+/****Abandon All Hope******/
+/**************************/
+/*** ***/
+/*** ***/
+/*** ***/
+/*** ***/
+
+
+#if 0
+
%%{
machine setdirection;
main := direction;
write data;
-
+
+
}%%
+
int
lexer_setdirection
(uint8_t* str, int size)
-/**************************/
-/****Abandon All Hope******/
-/**************************/
-/*** ***/
-/*** ***/
-/*** ***/
-/*** ***/
-
-
-#if 0
%%{
machine setstr;