X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lexer%2Fmain.c;h=40ff04d540f95c4b7e6fa16b984d8e188997af6d;hb=fa60d3b49e93c94e140541edac812946eb27b39b;hp=fd6a5ccc021f95a3e4d4be840b7b0d59dbded866;hpb=62426b89828710e58dcd043f03d7c8006c07b5d6;p=TP_AL_C.git diff --git a/lexer/main.c b/lexer/main.c index fd6a5cc..40ff04d 100644 --- a/lexer/main.c +++ b/lexer/main.c @@ -40,6 +40,7 @@ bool istAlpha() { 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 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'Ô' || \ @@ -119,11 +120,11 @@ SS2: SECTION: tokenType = SECTION; - return 1; + return EXIT_SUCCESS; SSECTION: tokenType = SSECTION; - return 1; + return EXIT_SUCCESS; M1: if (istAlpha()) { @@ -188,11 +189,11 @@ initLV1LV2: NPARA: tokenType = NPARA; - return 1; + return EXIT_SUCCESS; MOT: tokenType = MOT; - return 1; + return EXIT_SUCCESS; MC2: if (isSeparator() || c == WEOF) { @@ -202,15 +203,15 @@ MC2: MOTCLE: tokenType = MOTCLE; - return 1; + return EXIT_SUCCESS; FIN: tokenType = FIN; - return 1; + return EXIT_SUCCESS; error: tokenType = FIN; - return -1; + return EXIT_FAILURE; } int main() { @@ -233,11 +234,11 @@ int main() { c = fgetwc(source); // lecture du premier caractere do { int scanrt = scanner(); - if (scanrt == -1) { + if (scanrt == EXIT_FAILURE) { wprintf(L"Scanner error with token value: %ls\n", token[tokenFound].value); exit(EXIT_FAILURE); } - if (c != WEOF) { + if (tokenType == MOT || tokenType == MOTCLE) { wprintf(L"%20s: %ls\n", tokenTypestr[tokenType], token[tokenFound].value); } else { wprintf(L"%20s\n", tokenTypestr[tokenType]); @@ -249,5 +250,5 @@ int main() { if (source != NULL) fclose(source); // fermeture du fichier source if (target != NULL) fclose(target); // fermeture du fichier target - return 0; + return EXIT_SUCCESS; }