2
* Ajouter une pile contenant tout les environnements.
5
* flex -+ -otexparser.cc texparser.lex
6
* g++ -o texparser texparser.cc -lfl -lm
13
#include <sys/param.h>
27
commande \\[a-zA-Z]+{param}?{option}?{group}?
39
b_env \\begin\{{letter}+\}
40
e_env \\end\{{letter}+\}
47
space ({ws}|\~|\\space)
50
symbol ("$"("\\"{atoz}+|.)"$"|"\\#"|"\\$"|"\\%"|"\\ref")
54
<INITIAL,ENV>{b_env} {
55
printf("Entre dans un env. : %s\n", yytext);
61
printf("Sort d'un env.\n");
67
<INITIAL,ENV>{commande} {
68
printf("Commande : %s\n", yytext);
74
printf("Nouvelle ligne\n");
78
printf("Sort du mode math\n");
84
printf("Entre dans le mode math\n");
90
<INITIAL,ENV>{comments} {
91
printf("commentaire : %s\n", yytext);
94
<INITIAL,ENV>{texte} {
95
printf("texte : %s\n", yytext);
99
printf("texte mathematique : %s\n", yytext);
109
fprintf(stdout, "init. stack!\n");
110
stack = (Stack *) malloc(stack_size * sizeof(Stack));
112
if ( stackp == stack_size )
116
stack = (Stack *) realloc(stack, stack_size * sizeof(Stack));
119
fprintf(stderr, "texparser: stack out of memory");
122
fprintf(stdout, "%d", stack);
125
/*if ( (stack[stackp].name =
126
(int *) malloc(strlen(name) + 1)) == NULL )
128
fprintf(stderr, "texparser: out of memory\n");
132
stack[stackp].name = name;
133
fprintf(stdout, "type added in stack : %d\n", name);
142
fprintf(stderr, "texparser: Stack underflow\n");
146
if(stack[stackp - 1].name == name)
149
//free(stack[stackp].name);
153
fprintf(stderr, "texparser : Bad env.\n");