projects
/
henge
/
apc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
626bf46
)
enable lexer
author
ken
<ken@mihrtec.com>
Sat, 14 Jan 2017 20:25:40 +0000
(12:25 -0800)
committer
ken
<ken@mihrtec.com>
Sat, 14 Jan 2017 20:25:40 +0000
(12:25 -0800)
src/scanner.c
patch
|
blob
|
history
diff --git
a/src/scanner.c
b/src/scanner.c
index
686e1fe
..
96b66b6
100644
(file)
--- a/
src/scanner.c
+++ b/
src/scanner.c
@@
-20,6
+20,7
@@
#include <unistd.h> //chdir
#include <dirent.h> //opendir
#include <unistr.h> //unicode strings
#include <unistd.h> //chdir
#include <dirent.h> //opendir
#include <unistr.h> //unicode strings
+#include <string.h> //strlen
/* Internal */
#include "parser.tab.h"
/* Public */
/* Internal */
#include "parser.tab.h"
/* Public */
@@
-30,10
+31,8
@@
int scanner_scandir(DIR*);
yypstate* apc_pstate;
yycstate* apc_cstate;
/* Private */
yypstate* apc_pstate;
yycstate* apc_cstate;
/* Private */
-extern //lexer.c
-int lexer_lexfile(uint8_t const*);
extern //lexer.rl
extern //lexer.rl
-int lexer_lex
string(uint8_t const*, int
);
+int lexer_lex
file(uint8_t const*
);
#define PUSHTOK(T,L) yypush_parse(apc_pstate, T, L, apc_cstate)
/* Init
#define PUSHTOK(T,L) yypush_parse(apc_pstate, T, L, apc_cstate)
/* Init
@@
-95,23
+94,23
@@
int scanner_scandir
switch (direntp->d_type)
{ case DT_REG:
printf("lexfile %s\n",direntp->d_name);
switch (direntp->d_type)
{ case DT_REG:
printf("lexfile %s\n",direntp->d_name);
-
//
lexer_lexfile((uint8_t*)direntp->d_name);
+ lexer_lexfile((uint8_t*)direntp->d_name);
goto scan_next_dirent;
case DT_DIR:
goto scan_next_dirent;
case DT_DIR:
-
//lexer_lexstring
((uint8_t*)direntp->d_name); //lex the dirname
+
lexer_lexfile
((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, 0
); //push "Open Directory" token
+
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, 0
); //push "Close Directory" token
+
PUSHTOK(CLCLOSE, NULL
); //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: