repositories
/
TP_AL_C.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Makefile: allow to override the build type variable.
[TP_AL_C.git]
/
lexer
/
lexical_analyzer.c
diff --git
a/lexer/lexical_analyzer.c
b/lexer/lexical_analyzer.c
index 56415a01a914f73c8ee3355fada66416d6f10ead..39c82e075169b69eb50ce895bc283227a45f72cc 100644
(file)
--- a/
lexer/lexical_analyzer.c
+++ b/
lexer/lexical_analyzer.c
@@
-5,6
+5,7
@@
#include "global_vars.h"
#include "print_helper.h"
#include "global_vars.h"
#include "print_helper.h"
+#include "lexical_analyzer.h"
wint_t c;
wint_t c;
@@
-46,7
+47,8
@@
static bool isEOF() {
return false;
}
return false;
}
-int scanner() {
+int scanner(void) {
+ tokenValue[0] = 0;
unsigned int i = 0;
wchar_t m[6];
unsigned int i = 0;
wchar_t m[6];
@@
-68,7
+70,7
@@
init:
goto S1SS1;
}
if (isAlphaNum()) {
goto S1SS1;
}
if (isAlphaNum()) {
- token
[tokenFound].v
alue[i] = c;
+ token
V
alue[i] = c;
i++;
c = fgetwc(source);
goto M1;
i++;
c = fgetwc(source);
goto M1;
@@
-80,12
+82,12
@@
init:
MC1:
if (c == L'A' && !wcscmp(fgetws(m, 6, source), L"uteur")) {
MC1:
if (c == L'A' && !wcscmp(fgetws(m, 6, source), L"uteur")) {
- wcscpy((wchar_t*)token
[tokenFound].v
alue, L">Auteur");
+ wcscpy((wchar_t*)token
V
alue, L">Auteur");
c = fgetwc(source);
goto MC2;
}
if (c == L'T' && !wcscmp(fgetws(m, 5, source), L"itre")) {
c = fgetwc(source);
goto MC2;
}
if (c == L'T' && !wcscmp(fgetws(m, 5, source), L"itre")) {
- wcscpy((wchar_t*)token
[tokenFound].v
alue, L">Titre");
+ wcscpy((wchar_t*)token
V
alue, L">Titre");
c = fgetwc(source);
goto MC2;
}
c = fgetwc(source);
goto MC2;
}
@@
-117,7
+119,7
@@
SSECTION:
M1:
if (isAlphaNum()) {
M1:
if (isAlphaNum()) {
- token
[tokenFound].v
alue[i] = c;
+ token
V
alue[i] = c;
i++;
c = fgetwc(source);
goto M1;
i++;
c = fgetwc(source);
goto M1;
@@
-137,7
+139,7
@@
initLV1:
goto initLV1LV2;
}
if (isAlphaNum()) {
goto initLV1LV2;
}
if (isAlphaNum()) {
- token
[tokenFound].v
alue[i] = c;
+ token
V
alue[i] = c;
i++;
c = fgetwc(source);
goto M1;
i++;
c = fgetwc(source);
goto M1;
@@
-182,6
+184,8
@@
NPARA:
MOT:
tokenType = MOT;
MOT:
tokenType = MOT;
+ tokenValue[i] = 0;
+ wcscpy((wchar_t*)token[tokenFound].value, (wchar_t*)tokenValue);
return EXIT_SUCCESS;
MC2:
return EXIT_SUCCESS;
MC2:
@@
-192,6
+196,7
@@
MC2:
MOTCLE:
tokenType = MOTCLE;
MOTCLE:
tokenType = MOTCLE;
+ wcscpy((wchar_t*)token[tokenFound].value, (wchar_t*)tokenValue);
return EXIT_SUCCESS;
FIN:
return EXIT_SUCCESS;
FIN:
@@
-203,7
+208,7
@@
error:
fwprintf(stderr, L"%s error with token type: %s and value: %ls\n",
__func__,
tokenTypestr[tokenType],
fwprintf(stderr, L"%s error with token type: %s and value: %ls\n",
__func__,
tokenTypestr[tokenType],
- token
[tokenFound].v
alue);
+ token
V
alue);
} else {
fwprintf(stderr, L"%s error with token type: %s\n",
__func__,
} else {
fwprintf(stderr, L"%s error with token type: %s\n",
__func__,