Add FIXME comment for MOTCLE matching
[TP_AL_C.git] / lexer / main.c
index 0cb3dba1eaaaac205a7d7ec6de1a422cc94dc462..8122023c63a6a6ded748ea99eda9cfba89d1e840 100644 (file)
@@ -17,7 +17,7 @@ enum TokenType {
 } tokenType;
 const char* tokenTypestr[] = { "MOTCLE", "SECTION", "SSECTION", "NPARA", "MOT", "FIN" };
 
-/* This looks silly to check for each characters but for debugging, it's just the way to go */
+/* It looks silly to check for each characters but for debugging, it's just the way to go */
 bool istAlpha() {
     if (c == 'a' || c == 'b' || c == 'c' || c == 'd' || c == 'e' || c == 'f' || c == 'g' || \
         c == 'h' || c == 'i' || c == 'j' || c == 'k' || c == 'l' || c == 'm' || c == 'n' || \
@@ -44,9 +44,9 @@ bool isSeparator() {
 }
 
 int scanner() {
-const char* Titre = "Titre";
-const char* Auteur = "Auteur";
-unsigned int j = 0;
+    const char* Titre = "Titre";
+    const char* Auteur = "Auteur";
+    unsigned int j = 0;
 
 // The main loop get the next character
 init:
@@ -87,6 +87,7 @@ init:
     }
 
 MC1:
+    // FIXME: Partial match need a rewind in the characters extraction from the file 
     if (c == Titre[j] && j < strlen(Titre) - 1) {
         c = fgetc(source);
         tokenValue[i] = c;
@@ -118,7 +119,6 @@ S1SS1:
         goto SECTION;
     }
 
-
 SS2:
     if (isSeparator() || c == EOF) {
         goto SSECTION;
@@ -250,7 +250,6 @@ int main (int argc, char const *argv[]) {
 
     do {
         c = fgetc(source); // lecture du caractere suivant du fichier source
-        //fputc(c, target);  // ecrire c dans le fichier target
         tokenValue[i] = c;
         i++;
         int scanrt = scanner();
@@ -266,7 +265,7 @@ int main (int argc, char const *argv[]) {
         // reinit tokenValue
         i = 0;
         memset(tokenValue, 0, sizeof(tokenValue));
-    } while (c != EOF);    // tant que la fin du fichier n'est pas atteinte
+    } while (c != EOF); // tant que la fin du fichier n'est pas atteinte
 
     if (source != NULL) fclose(source); // fermeture du fichier source
     if (target != NULL) fclose(target); // fermeture du fichier target