X-Git-Url: https://git.piment-noir.org/?p=TP_AL_C.git;a=blobdiff_plain;f=lexer%2Fsyntactic_analyzer.c;h=0f1b1818b3a6c2ced9a65c8cc912fe3bd61385e2;hp=65997ddfed47b40dad0ef4008599cbd8cb2a5828;hb=2d2a5978e84c354bf8167a3ab0b1088d264049bf;hpb=15ad4b5ab7b62ce2e966730ccd1932877d658b66 diff --git a/lexer/syntactic_analyzer.c b/lexer/syntactic_analyzer.c index 65997dd..0f1b181 100644 --- a/lexer/syntactic_analyzer.c +++ b/lexer/syntactic_analyzer.c @@ -1,12 +1,12 @@ /* Syntactic analyzer */ #include -#include #include #include "global_vars.h" -#include "lexical_analyzer.h" #include "print_helper.h" +#include "syntactic_analyzer.h" +#include "lexical_analyzer.h" #define PRINT_TOKEN 1 @@ -46,11 +46,11 @@ static void analyze_P() { if (tokenType == NPARA) { #if PRINT_TOKEN wprint_ctoken(stdout); - #endif - scanner(); + #endif /* PRINT_TOKEN */ if (target != NULL) { fputws(L"

\n", target); } + scanner(); analyze_TEXT(); if (target != NULL) { fputws(L"\n

\n", target); @@ -70,8 +70,7 @@ static void analyze_HEAD() { #if DEBUG fprintf(stdout, "entering %s\n", __func__); #endif - if (tokenType == MOTCLE) { - //FIXME: Check if the MOTCLE token value is set to >Titre + if (tokenType == MOTCLE && wcscmp(L">Titre", (const wchar_t*)tokenValue) == 0) { if (target != NULL) { fputws(L"\n", target); fputws(L" ", target); @@ -81,13 +80,12 @@ static void analyze_HEAD() { if (target != NULL) { fputws(L"\n\n", target); } - if (tokenType == MOTCLE) { + if (tokenType == MOTCLE && wcscmp(L">Auteur", (const wchar_t*)tokenValue) == 0) { #if PRINT_TOKEN wprint_ctoken(stdout); #endif /* PRINT_TOKEN */ - scanner(); - //The text contain the author fputws(L"", target); } else if (tokenType != NPARA && tokenType != SECTION && tokenType != FIN) { @@ -197,7 +195,7 @@ static void analyze_BODY() { #endif } -void analyze_AXIOME() { +void analyze_AXIOME(void) { #if DEBUG fprintf(stdout, "entering %s\n", __func__); #endif @@ -219,6 +217,9 @@ void analyze_AXIOME() { if (target != NULL) { fputws(L"\n\n", target); } + #if PRINT_TOKEN + wprint_ctoken(stdout); + #endif /* PRINT_TOKEN */ if (tokenType != FIN) { fprintf(stderr, "%s follows error on %s\n", __func__, tokenTypestr[tokenType]); fflush(stderr);