1 | /* *** Paramètre de configuration */ |
---|
2 | |
---|
3 | %{ |
---|
4 | /* déf des tokens*/ |
---|
5 | #include "Configuration_files_parser.h" |
---|
6 | #include <string.h> |
---|
7 | |
---|
8 | unsigned int lineno = 1; |
---|
9 | |
---|
10 | %} |
---|
11 | |
---|
12 | alpha [A-Za-z] |
---|
13 | chiffre [0-9] |
---|
14 | caractere [-_.] |
---|
15 | nom ({alpha}|{chiffre}|{caractere}) |
---|
16 | |
---|
17 | /*----- [ Rules ]------------------------------------- */ |
---|
18 | %s configuration commentaire |
---|
19 | |
---|
20 | %% |
---|
21 | %{ |
---|
22 | BEGIN configuration; |
---|
23 | %} |
---|
24 | <configuration>"<!--" { yylval.token = strdup(yytext); BEGIN(commentaire); } /* Balise de début de commentaires */ |
---|
25 | <commentaire>"-->" { yylval.token = strdup(yytext); BEGIN(configuration); } /* Balise de fin de commentaires */ |
---|
26 | |
---|
27 | |
---|
28 | " "|\t { yylval.token = strdup(yytext); } |
---|
29 | \n { yylval.token = strdup(yytext); lineno ++; } |
---|
30 | |
---|
31 | |
---|
32 | <configuration>"<?xml" { yylval.token = strdup(yytext); return BEGIN_XML; } |
---|
33 | <configuration>"?>" { yylval.token = strdup(yytext); return END_XML; } |
---|
34 | |
---|
35 | <configuration>"<cpu" { yylval.token = strdup(yytext); return BEGIN_CPU; } |
---|
36 | <configuration>"</cpu" { yylval.token = strdup(yytext); return END_CPU; } |
---|
37 | |
---|
38 | <configuration>"<definition" { yylval.token = strdup(yytext); return BEGIN_DEFINITION; } |
---|
39 | <configuration>"</definition" { yylval.token = strdup(yytext); return END_DEFINITION; } |
---|
40 | |
---|
41 | <configuration>"<internal" { yylval.token = strdup(yytext); return BEGIN_INTERNAL; } |
---|
42 | <configuration>"</internal" { yylval.token = strdup(yytext); return END_INTERNAL; } |
---|
43 | |
---|
44 | <configuration>"<type" { yylval.token = strdup(yytext); return BEGIN_TYPE; } |
---|
45 | <configuration>"</type" { yylval.token = strdup(yytext); return END_TYPE; } |
---|
46 | |
---|
47 | <configuration>"<latence" { yylval.token = strdup(yytext); return BEGIN_LATENCE; } |
---|
48 | <configuration>"</latence" { yylval.token = strdup(yytext); return END_LATENCE; } |
---|
49 | |
---|
50 | <configuration>"<global" { yylval.token = strdup(yytext); return BEGIN_GLOBAL; } |
---|
51 | <configuration>"</global" { yylval.token = strdup(yytext); return END_GLOBAL; } |
---|
52 | |
---|
53 | <configuration>"<isa" { yylval.token = strdup(yytext); return BEGIN_ISA; } |
---|
54 | <configuration>"</isa" { yylval.token = strdup(yytext); return END_ISA; } |
---|
55 | |
---|
56 | <configuration>"<cache" { yylval.token = strdup(yytext); return BEGIN_CACHE; } |
---|
57 | <configuration>"</cache" { yylval.token = strdup(yytext); return END_CACHE; } |
---|
58 | |
---|
59 | <configuration>"<icache" { yylval.token = strdup(yytext); return BEGIN_ICACHE; } |
---|
60 | <configuration>"</icache" { yylval.token = strdup(yytext); return END_ICACHE; } |
---|
61 | |
---|
62 | <configuration>"<dcache" { yylval.token = strdup(yytext); return BEGIN_DCACHE; } |
---|
63 | <configuration>"</dcache" { yylval.token = strdup(yytext); return END_DCACHE; } |
---|
64 | |
---|
65 | <configuration>"<ifetch" { yylval.token = strdup(yytext); return BEGIN_IFETCH; } |
---|
66 | <configuration>"</ifetch" { yylval.token = strdup(yytext); return END_IFETCH; } |
---|
67 | |
---|
68 | <configuration>"<prediction" { yylval.token = strdup(yytext); return BEGIN_PREDICTION; } |
---|
69 | <configuration>"</prediction" { yylval.token = strdup(yytext); return END_PREDICTION; } |
---|
70 | |
---|
71 | <configuration>"<operation" { yylval.token = strdup(yytext); return BEGIN_OPERATION; } |
---|
72 | <configuration>"<allow" { yylval.token = strdup(yytext); return BEGIN_ALLOW; } |
---|
73 | <configuration>"<ORBIS" { yylval.token = strdup(yytext); return BEGIN_ORBIS; } |
---|
74 | <configuration>"<ORFPX" { yylval.token = strdup(yytext); return BEGIN_ORFPX; } |
---|
75 | <configuration>"<ORVDX" { yylval.token = strdup(yytext); return BEGIN_ORVDX; } |
---|
76 | <configuration>"<size_data" { yylval.token = strdup(yytext); return BEGIN_SIZE_DATA ; } |
---|
77 | <configuration>"<scheme_bypass" { yylval.token = strdup(yytext); return BEGIN_SCHEME_BYPASS ; } |
---|
78 | <configuration>"<arbiter" { yylval.token = strdup(yytext); return BEGIN_ARBITER ; } |
---|
79 | <configuration>"<nb_port" { yylval.token = strdup(yytext); return BEGIN_NB_PORT ; } |
---|
80 | <configuration>"<affectation" { yylval.token = strdup(yytext); return BEGIN_AFFECTATION; } |
---|
81 | |
---|
82 | <configuration>"<nb_inst_fetch" { yylval.token = strdup(yytext); return BEGIN_NB_INST_FETCH ; } |
---|
83 | <configuration>"<size_fetch_queue" { yylval.token = strdup(yytext); return BEGIN_SIZE_FETCH_QUEUE; } |
---|
84 | <configuration>"<link_icache" { yylval.token = strdup(yytext); return BEGIN_LINK_ICACHE ; } |
---|
85 | <configuration>"<link_predictor" { yylval.token = strdup(yytext); return BEGIN_LINK_PREDICTOR ; } |
---|
86 | <configuration>"<link_decod" { yylval.token = strdup(yytext); return BEGIN_LINK_DECOD ; } |
---|
87 | |
---|
88 | <configuration>">" { yylval.token = strdup(yytext); return END_BALISE_DUAL;} |
---|
89 | <configuration>"/>" { yylval.token = strdup(yytext); return END_SINGLETON;} |
---|
90 | |
---|
91 | <configuration>"=" { yylval.token = strdup(yytext); return EQUAL; } |
---|
92 | <configuration>"\"" { yylval.token = strdup(yytext); return QUOTE; } |
---|
93 | |
---|
94 | |
---|
95 | <configuration>"version" { yylval.token = strdup(yytext); return VERSION ; } |
---|
96 | <configuration>"encoding" { yylval.token = strdup(yytext); return ENCODING ; } |
---|
97 | <configuration>"name" { yylval.token = strdup(yytext); return NAME ; } |
---|
98 | <configuration>"id" { yylval.token = strdup(yytext); return ID ; } |
---|
99 | <configuration>"delay" { yylval.token = strdup(yytext); return DELAY ; } |
---|
100 | <configuration>"latence" { yylval.token = strdup(yytext); return LATENCE ; } |
---|
101 | <configuration>"type" { yylval.token = strdup(yytext); return TYPE ; } |
---|
102 | <configuration>"value" { yylval.token = strdup(yytext); return VALUE ; } |
---|
103 | <configuration>"algo" { yylval.token = strdup(yytext); return ALGO ; } |
---|
104 | |
---|
105 | <configuration>"true" { yylval.token = strdup(yytext); yylval.value_int = 1; return INTEGER;} |
---|
106 | <configuration>"false" { yylval.token = strdup(yytext); yylval.value_int = 0; return INTEGER;} |
---|
107 | |
---|
108 | <configuration>{chiffre}+"."{chiffre}+ { yylval.token = strdup(yytext); yylval.value_float = atof(yytext); return FLOAT;} |
---|
109 | <configuration>{chiffre}+ { yylval.token = strdup(yytext); yylval.value_int = atoi(yytext); return INTEGER;} |
---|
110 | <configuration>{nom}+ { yylval.token = strdup(yytext); yylval.name = strdup(yytext); return STRING;} |
---|
111 | |
---|
112 | |
---|
113 | <commentaire>. { yylval.token = strdup(yytext); } |
---|
114 | . { yylval.token = strdup(yytext); return (*yytext); } /* Toute autre caractère */ |
---|
115 | %% |
---|
116 | |
---|
117 | /* *** Fonctions auxiliaire */ |
---|
118 | |
---|
119 | int yywrap() |
---|
120 | { |
---|
121 | return (-1); |
---|
122 | } |
---|