X-Git-Url: https://git.piment-noir.org/?p=TP_AL_C.git;a=blobdiff_plain;f=lexer%2Flexical_analyzer.c;h=32efd0b5af735e648418568d72c43339dae6b10d;hp=0d6a7284abb35cb064fd40885d980bfb8c9a74f0;hb=dfbc1df9a95408687918ecc2bc6774d4646dd4f9;hpb=15ad4b5ab7b62ce2e966730ccd1932877d658b66 diff --git a/lexer/lexical_analyzer.c b/lexer/lexical_analyzer.c index 0d6a728..32efd0b 100644 --- a/lexer/lexical_analyzer.c +++ b/lexer/lexical_analyzer.c @@ -69,7 +69,6 @@ init: goto S1SS1; } if (isAlphaNum()) { - token[tokenFound].value[i] = c; tokenValue[i] = c; i++; c = fgetwc(source); @@ -82,13 +81,11 @@ 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; @@ -121,7 +118,6 @@ SSECTION: M1: if (isAlphaNum()) { - token[tokenFound].value[i] = c; tokenValue[i] = c; i++; c = fgetwc(source); @@ -142,7 +138,6 @@ initLV1: goto initLV1LV2; } if (isAlphaNum()) { - token[tokenFound].value[i] = c; tokenValue[i] = c; i++; c = fgetwc(source); @@ -187,9 +182,9 @@ NPARA: return EXIT_SUCCESS; MOT: - token[tokenFound].value[i] = 0; - tokenValue[i] = 0; tokenType = MOT; + tokenValue[i] = 0; + wcscpy((wchar_t*)token[tokenFound].value, (wchar_t*)tokenValue); return EXIT_SUCCESS; MC2: @@ -200,6 +195,7 @@ MC2: MOTCLE: tokenType = MOTCLE; + wcscpy((wchar_t*)token[tokenFound].value, (wchar_t*)tokenValue); return EXIT_SUCCESS; FIN: @@ -211,7 +207,7 @@ error: fwprintf(stderr, L"%s error with token type: %s and value: %ls\n", __func__, tokenTypestr[tokenType], - token[tokenFound].value); + tokenValue); } else { fwprintf(stderr, L"%s error with token type: %s\n", __func__,