}
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:
i++;
goto init;
}
+ if (c == '\n') {
+ c = fgetc(source);
+ tokenValue[i] = c;
+ i++;
+ goto initLV1;
+ }
if (c == '>') {
c = fgetc(source);
tokenValue[i] = c;
i++;
goto M1;
}
- if (c == '\n') {
- c = fgetc(source);
- tokenValue[i] = c;
- i++;
- goto initLV1;
- }
if (c == EOF) {
goto FIN;
} else {
goto SECTION;
}
-
SS2:
if (isSeparator() || c == EOF) {
goto SSECTION;
}
initLV1:
- if (c == '\n' || c == '\t') {
+ if (c == ' ' || c == '\t') {
c = fgetc(source);
tokenValue[i] = c;
i++;
goto initLV1;
}
+ if (c == '\n') {
+ c = fgetc(source);
+ tokenValue[i] = c;
+ i++;
+ goto initLV1LV2;
+ }
if (istAlpha()) {
c = fgetc(source);
tokenValue[i] = c;
i++;
goto MC1;
}
- if (c == '\n') {
- c = fgetc(source);
- tokenValue[i] = c;
- i++;
- goto initLV1LV2;
- }
if (c == EOF) {
goto FIN;
}
i++;
goto initLV1LV2;
}
+ if (istAlpha()) {
+ goto NPARA;
+ }
if (c == '>') {
c = fgetc(source);
tokenValue[i] = c;
i++;
goto S1SS1;
}
- if (istAlpha()) {
- goto NPARA;
- }
if (c == EOF) {
goto FIN;
}
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();
} else {
printf ("Token type found: %s\n", tokenTypestr[tokenType]);
}
- // reinit
+ // 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