#include "parser.tab.h"
/* Public */
-int scanner_init(void);
-void scanner_quit(void);
-int scanner(void);
+int scanner_init(void);
+void scanner_quit(void);
+int scanner(void);
/* Private */
#ifndef DL_STACKSIZE
#define DL_STACKSIZE 64
#define ERR_DEPTH "Fatal: Maximum directory depth of " $(DL_STACKSIZE) \
" exceeded during directory scan\n"
#define ERR_DL "Fatal: Directory List Stack Corruption %x\n", DL_LEN()
-#define TOK_CLOPEN 0x55, 1 //TODO
-#define TOK_CLCLOSE 0x56, 1 //TODO
()
{ struct dirent* direntp;
struct DIR* DIRp;
if (DL_CD_LEN() > 0) //There are entities to process
{ if ((direntp = DL_CD_POP()) == NULL)//If the dirent is null, the library
goto libfail; //function in dirent has failed
- printf("Lexdir %s\n",direntp->d_name);
lexer_lex(direntp->d_name); //lex the directory name
if (DL_LEN() >= DL_STACKSIZE) //fail if maxdepth exceeded
{ fprintf(stderr, ERR_DEPTH);
DL_PUSH(opendir(CWDSTR));
if (DL_CURDIR() == NULL) //open the cwd
goto libfail;
- lexer_pushtok(TOK_CLOPEN); //Push "Open Directory" token
+ lexer_pushtok(CLOPEN, 0); //Push "Open Directory" token
return dredge_current_depth(); //Filter and sort the current depth
}
else if (DL_LEN() >= 0) //Any dirs left? (Including root)
goto libfail;
if (DL_LEN() == -1) //If we just popped root,
return 0; //we're done
- lexer_pushtok(TOK_CLCLOSE); //Else push "Close Directory" token,
+ lexer_pushtok(CLCLOSE, 0); //Else push "Close Directory" token,
if (!chdir("..")) //move up a directory and
goto parse; //start over
}
return DPS_LEN();
}
+