- /* If last file was a mapfile, then its 5th to last token should
- be a MOPEN. If this is the case, then we only pass MOPEN, height,
- weight and name of the current file. */
- if( (TK_STACKX - 5)->tok_t == MOPEN )
- { printf("The last file was a mapfile\n");
- if( (map_begin = strstr(map_key, str)) ) //if the current file is a mapfile
- { printf("The current file is a variant of the last mapfile\n");
- printf("Start lexing mapfile %s\n", str);
- ntok += lexer_lexstring(map_begin, strlen(map_begin));
+ ntok += lexer_lexstring(str, len);
+
+ /* Need to add map variant name 'default' if user did not specify a
+ map variant name */
+ /* if(filetype == ele_map) */
+ /* { if(!u8_strchr(str, '_')) //map variant name not provided */
+ /* { yylval.str = "default"; */
+ /* lexer_pushtok(NAME, yylval); */
+ /* ntok++; */
+ /* printf("Pushing default ele_map name\n"); */
+ /* } */
+ /* } */
+
+ /* Pass back filepath as end of statment operator */
+ filepath = u8_strdup(lexer_get_current_filepath());
+ yylval.str = filepath;
+ lexer_pushtok(NAME, yylval);
+ printf("Pushing filepath %s\n", filepath);
+ ntok++;
+
+ printf("|---- Ending lexer_lexfilename on %s, %d tokens were lexed ----|\n", str, ntok);
+ return ntok;
+}
+
+int
+lexer_lexelemap
+( uint8_t* str)
+{ int setname_len, elename_len, strlen;
+ uint8_t* setname_end, *elename_end, *newstrt;
+ uint8_t curr_setname[MAX_SETNAME_LEN] = {0};
+ uint8_t curr_elename[MAX_ELENAME_LEN] = {0};
+
+ newstrt = str;
+
+ SET_CURR_SETNAME(newstrt);
+ SET_CURR_ELENAME(newstrt);
+ if(PREV_MAPFILE())
+ { printf("*previous file was mapfile*\n");
+ SET_MAPSTR(newstrt);
+ }
+ else
+ {
+ if(SETNAME_MATCHES())
+ { DEL_FTOK(newstrt);
+ if(REF(newstrt))
+ DEL_FTOK(newstrt);
+ printf("setname matches\n");
+ if(ELENAME_MATCHES())
+ DEL_FTOK(newstrt);
+ if(REF(str))
+ DEL_FTOK(newstrt);
+ }
+ }
+ UPDATE_PREV_ELENAME(newstrt);
+ UPDATE_PREV_SETNAME(newstrt);
+
+ return newstrt - str;
+
+
+}
+
+int
+lexer_lexelemodel
+(uint8_t* str)
+{ int setname_len, elename_len;
+ uint8_t* setname_end, *elename_end, *newstrt;
+ uint8_t curr_setname[MAX_SETNAME_LEN] = {0};
+ uint8_t curr_elename[MAX_ELENAME_LEN] = {0};
+
+ printf("In lexelemodel, str is %s\n", str);
+
+ newstrt = str;
+
+ SET_CURR_SETNAME(newstrt);
+ SET_CURR_ELENAME(newstrt);
+ if(SETNAME_MATCHES())
+ { printf("in ele_model: setname matches\n");
+ DEL_FTOK(newstrt);
+ printf("newstrt is now %s\n", newstrt);
+ if(REF(newstrt))
+ DEL_FTOK(newstrt);
+ if(ELENAME_MATCHES())
+ { printf("in ele_model: elename matches\n");
+ DEL_FTOK(newstrt);
+ if(REF(newstrt))
+ DEL_FTOK(newstrt);