Fix the syntactic analyzer for real.
[TP_AL_C.git] / lexer / lexical_analyzer.c
index 56415a01a914f73c8ee3355fada66416d6f10ead..0d6a7284abb35cb064fd40885d980bfb8c9a74f0 100644 (file)
@@ -47,6 +47,7 @@ static bool isEOF() {
 }
 
 int scanner() {
+    tokenValue[0] = 0;
     unsigned int i = 0;
     wchar_t m[6];
 
@@ -69,6 +70,7 @@ init:
     }
     if (isAlphaNum()) {
         token[tokenFound].value[i] = c;
+        tokenValue[i] = c;
         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");
+        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");
+        wcscpy((wchar_t*)tokenValue, L">Titre");
         c = fgetwc(source);
         goto MC2;
     }
@@ -118,6 +122,7 @@ SSECTION:
 M1:
     if (isAlphaNum()) {
         token[tokenFound].value[i] = c;
+        tokenValue[i] = c;
         i++;
         c = fgetwc(source);
         goto M1;
@@ -138,6 +143,7 @@ initLV1:
     }
     if (isAlphaNum()) {
         token[tokenFound].value[i] = c;
+        tokenValue[i] = c;
         i++;
         c = fgetwc(source);
         goto M1;
@@ -181,6 +187,8 @@ NPARA:
     return EXIT_SUCCESS;
 
 MOT:
+    token[tokenFound].value[i] = 0;
+    tokenValue[i] = 0;
     tokenType = MOT;
     return EXIT_SUCCESS;