X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fapc.git;a=blobdiff_plain;f=src%2Flexer.c;h=362d62b775d18b495c56c3e035ebb9dc669c7e62;hp=b01b29241e556e2c440996be3d9efcd5b1f02816;hb=d47bdba72dd5fef398bc485067fdc59147303253;hpb=55eb5697b20b577ecb4a3c6355c1ee4695f016cd diff --git a/src/lexer.c b/src/lexer.c index b01b292..362d62b 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -113,7 +113,6 @@ int lexer_init printing is skipped. In all other cases, 'yylval' is set, and the token's integer representation is returned. */ -int lexer #define $($)#$ #define SCAN_ERROR -1 #define TK_EMPTY (TK_STACKP == TK_STACKX) @@ -122,6 +121,7 @@ int lexer fprintf(stderr,__VA_ARGS__); \ goto done; \ } while (0) +int lexer () { struct tok token; start: @@ -153,10 +153,12 @@ int lexer /* Token Receiver This receiver takes a struct tok and pushes it to the FIFO stack. */ -void lexer_pushtok #define $($)#$ //stringifier #define ERR_TK "Fatal: Generated over " $(TK_STACKSIZE) " tokens in one pass." -( int tok, YYSTYPE lval ) +void lexer_pushtok +( int tok, + YYSTYPE lval +) { if (TK_LEN() >= TK_STACKSIZE) { fprintf(stderr, ERR_TK); exit(EXIT_FAILURE); @@ -167,8 +169,8 @@ void lexer_pushtok /* Lexical analysis of a file Strips a filename to its base name, then sends it to lexer_lex */ -int lexer_lexfile #define HIDDEN_WARNING "%s is hidden and will not be parsed!\n", filename +int lexer_lexfile ( const uint8_t *filename ) { static uint8_t fname[FNAME_MAX]; @@ -207,7 +209,8 @@ uint8_t const* lexer_get_current_filepath /* Scan filename and push the its tokens onto the stack */ int lexer_lexfilename -(uint8_t* str) +( uint8_t* str +) { int ntok, len; uint8_t *filepath;