#include "apc.h"
#include "parser.tab.h"
/* Public */
-int lexer_lexfile(uint8_t const*);
/* Private */
extern //lexer.rl
int lexer_lexstring(uint8_t const*, int);
yypstate* apc_pstate;
extern //scanner.c
yycstate* apc_cstate;
-#define PUSHTOK(T,L) yypush_parse(apc_pstate, T, L, apc_cstate)
-/* Lexical analysis of a file
- Strips a filename to its base name, then sends it to lexer_lexstring before
- pushing a PATH token with the filename
- Returns the number of tokens pushed to the parser.
-*/
-int lexer_lexfile
-( uint8_t const* filename )
-{ uint8_t const* last_period,* iter;
- int ntok;
- union YYSTYPE tok_val;
- last_period = NULL;
- for (iter = filename; *iter; iter++)
- if (*iter == '.')
- last_period = iter;
- if (last_period)
- { ntok = lexer_lexstring(filename, (int)(last_period - filename));
- tok_val.str = filename;
- PUSHTOK(PATH,&tok_val);
- return ntok + 1;
- }
- return lexer_lexstring(filename, (int)(iter - filename));
-}
+