repositories
/
TP_AL_C.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
No need to zero the array of token values ends.
[TP_AL_C.git]
/
lexer
/
lexical_analyzer.c
diff --git
a/lexer/lexical_analyzer.c
b/lexer/lexical_analyzer.c
index 25526054ddd436ee3f24865bb5984e336b6a52bb..8805a54c13ec0647b306eeffdf8e869e2676c531 100644
(file)
--- a/
lexer/lexical_analyzer.c
+++ b/
lexer/lexical_analyzer.c
@@
-22,7
+22,7
@@
static bool isAlphaNum() {
c == L'\''|| c == L'#' || \
c == L'0' || c == L'1' || c == L'2' || c == L'3' || c == L'4' || c == L'5' || c == L'6' || \
c == L'7' || c == L'8' || c == L'9' || \
c == L'\''|| c == L'#' || \
c == L'0' || c == L'1' || c == L'2' || c == L'3' || c == L'4' || c == L'5' || c == L'6' || \
c == L'7' || c == L'8' || c == L'9' || \
- //
FIXME: Accentued characters (aka multibytes characters) support is still buggy
+ //FIXME: Accentued characters (aka multibytes characters) support is still buggy
c == L'à' || c == L'â' || c == L'ç' || c == L'è' || c == L'é' || c == L'î' || c == L'ô' || \
c == L'ù' || c == L'û' || \
c == L'À' || c == L'Â' || c == L'Ç' || c == L'È' || c == L'É' || c == L'Î' || c == L'Ô' || \
c == L'à' || c == L'â' || c == L'ç' || c == L'è' || c == L'é' || c == L'î' || c == L'ô' || \
c == L'ù' || c == L'û' || \
c == L'À' || c == L'Â' || c == L'Ç' || c == L'È' || c == L'É' || c == L'Î' || c == L'Ô' || \
@@
-47,6
+47,7
@@
static bool isEOF() {
}
int scanner() {
}
int scanner() {
+ tokenValue[0] = 0;
unsigned int i = 0;
wchar_t m[6];
unsigned int i = 0;
wchar_t m[6];
@@
-69,6
+70,7
@@
init:
}
if (isAlphaNum()) {
token[tokenFound].value[i] = c;
}
if (isAlphaNum()) {
token[tokenFound].value[i] = c;
+ tokenValue[i] = c;
i++;
c = fgetwc(source);
goto M1;
i++;
c = fgetwc(source);
goto M1;
@@
-81,11
+83,13
@@
init:
MC1:
if (c == L'A' && !wcscmp(fgetws(m, 6, source), L"uteur")) {
wcscpy((wchar_t*)token[tokenFound].value, L">Auteur");
MC1:
if (c == L'A' && !wcscmp(fgetws(m, 6, source), L"uteur")) {
wcscpy((wchar_t*)token[tokenFound].value, L">Auteur");
+ wcscpy((wchar_t*)tokenValue, L">Auteur");
c = fgetwc(source);
goto MC2;
}
if (c == L'T' && !wcscmp(fgetws(m, 5, source), L"itre")) {
wcscpy((wchar_t*)token[tokenFound].value, L">Titre");
c = fgetwc(source);
goto MC2;
}
if (c == L'T' && !wcscmp(fgetws(m, 5, source), L"itre")) {
wcscpy((wchar_t*)token[tokenFound].value, L">Titre");
+ wcscpy((wchar_t*)tokenValue, L">Titre");
c = fgetwc(source);
goto MC2;
}
c = fgetwc(source);
goto MC2;
}
@@
-118,6
+122,7
@@
SSECTION:
M1:
if (isAlphaNum()) {
token[tokenFound].value[i] = c;
M1:
if (isAlphaNum()) {
token[tokenFound].value[i] = c;
+ tokenValue[i] = c;
i++;
c = fgetwc(source);
goto M1;
i++;
c = fgetwc(source);
goto M1;
@@
-138,6
+143,7
@@
initLV1:
}
if (isAlphaNum()) {
token[tokenFound].value[i] = c;
}
if (isAlphaNum()) {
token[tokenFound].value[i] = c;
+ tokenValue[i] = c;
i++;
c = fgetwc(source);
goto M1;
i++;
c = fgetwc(source);
goto M1;
@@
-181,6
+187,7
@@
NPARA:
return EXIT_SUCCESS;
MOT:
return EXIT_SUCCESS;
MOT:
+ tokenValue[i] = 0;
tokenType = MOT;
return EXIT_SUCCESS;
tokenType = MOT;
return EXIT_SUCCESS;