Reorder some lexical analysis calls.
[TP_AL_C.git] / lexer / syntactic_analyzer.c
index 65997ddfed47b40dad0ef4008599cbd8cb2a5828..ae3251ae48c4da759f8f0fe02ef88aceefbffbc0 100644 (file)
@@ -1,7 +1,6 @@
 /* Syntactic analyzer */
 
 #include <stdbool.h>
-#include <stdarg.h>
 #include <stdlib.h>
 
 #include "global_vars.h"
@@ -46,11 +45,11 @@ static void analyze_P() {
     if (tokenType == NPARA) {
         #if PRINT_TOKEN
         wprint_ctoken(stdout);
-        #endif
-        scanner();
+        #endif /* PRINT_TOKEN */
         if (target != NULL) {
             fputws(L"<p>\n", target);
         }
+        scanner();
         analyze_TEXT();
         if (target != NULL) {
             fputws(L"\n</p>\n", target);
@@ -70,8 +69,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"<title>\n", target);
             fputws(L" ", target);
@@ -81,13 +79,12 @@ static void analyze_HEAD() {
         if (target != NULL) {
             fputws(L"\n</title>\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"<meta name=\"author\" content=\"", target);
+            scanner();
             analyze_TEXT();
             fputws(L"\">", target);
         } else if (tokenType != NPARA && tokenType != SECTION && tokenType != FIN) {