fixes
[henge/apc.git] / src / scanner.c
index 96b66b6..abf472e 100644 (file)
@@ -32,8 +32,11 @@ yypstate* apc_pstate;
 yycstate* apc_cstate;
 /* Private */
 extern //lexer.rl
 yycstate* apc_cstate;
 /* Private */
 extern //lexer.rl
-int   lexer_lexfile(uint8_t const*);
-#define PUSHTOK(T,L) yypush_parse(apc_pstate, T, L, apc_cstate)
+int   lexer_lexfile(uint8_t*);
+extern //lexer.rl
+int   lexer_lexdir(uint8_t*);
+extern //lexer.rl
+void  lexer_closedir(void);
 
 /* Init
    Establishes yy states
 
 /* Init
    Establishes yy states
@@ -97,20 +100,19 @@ int scanner_scandir
            lexer_lexfile((uint8_t*)direntp->d_name);
            goto scan_next_dirent;
          case DT_DIR:
            lexer_lexfile((uint8_t*)direntp->d_name);
            goto scan_next_dirent;
          case DT_DIR:
-           lexer_lexfile((uint8_t*)direntp->d_name);  //lex the dirname
+           lexer_lexdir((uint8_t*)direntp->d_name);  //lex the dirname
            printf("lexdir %s\n",direntp->d_name);
            if (chdir(direntp->d_name))    //change to the specified dir
              goto libfail;
            errno = 0;
            if ((cdirp = opendir(".")) == NULL || errno) //open it
              goto libfail;
            printf("lexdir %s\n",direntp->d_name);
            if (chdir(direntp->d_name))    //change to the specified dir
              goto libfail;
            errno = 0;
            if ((cdirp = opendir(".")) == NULL || errno) //open it
              goto libfail;
-           PUSHTOK(CLOPEN, NULL);           //push "Open Directory" token
            printf("Scanner entered [%s]\n",direntp->d_name);
            if(scanner_scandir(cdirp))    //scan the directory
              goto libfail;
            if (chdir(".."))              //return to the parent dir
              goto libfail;
            printf("Scanner entered [%s]\n",direntp->d_name);
            if(scanner_scandir(cdirp))    //scan the directory
              goto libfail;
            if (chdir(".."))              //return to the parent dir
              goto libfail;
-            PUSHTOK(CLCLOSE, NULL);          //push "Close Directory" token
+            lexer_closedir();            //push "Close Directory" token
            printf("Scanner returned\n");
            goto scan_next_dirent;        //continue scan
           case DT_UNKNOWN:
            printf("Scanner returned\n");
            goto scan_next_dirent;        //continue scan
           case DT_UNKNOWN: