My_Parser.cpp
| 1 |
#include "VParse.h" |
|---|---|
| 2 |
#include "VSymTable.h" |
| 3 |
#include "VAst.h" |
| 4 |
#include "My_Parser.h" |
| 5 |
#include <cstring> |
| 6 |
#include <deque> |
| 7 |
#include <stdio.h> |
| 8 |
#include <iostream> |
| 9 |
// #include <fstream>
|
| 10 |
|
| 11 |
My_Parser::~My_Parser() { }
|
| 12 |
|
| 13 |
void My_Parser::attributeCb(VFileLine* fl, const string& text) { |
| 14 |
/*if (callbackMasterEna() && m_useCb_attribute) {
|
| 15 |
cbFileline(fl);
|
| 16 |
static string hold1; hold1 = text;
|
| 17 |
call(NULL, 1, "attribute", hold1.c_str());
|
| 18 |
}*/
|
| 19 |
std::cout << "My_Parser::attributeCb called" << std::endl;
|
| 20 |
} |
| 21 |
|
| 22 |
void My_Parser::commentCb(VFileLine* fl, const string& text) { |
| 23 |
/*if (callbackMasterEna() && m_useCb_comment) {
|
| 24 |
cbFileline(fl);
|
| 25 |
static string hold1; hold1 = text;
|
| 26 |
call(NULL, 1, "comment", hold1.c_str());
|
| 27 |
}*/
|
| 28 |
std::cout << "My_Parser::commentCb called" << std::endl;
|
| 29 |
} |
| 30 |
|
| 31 |
void My_Parser::endparseCb(VFileLine* fl, const string& text) { |
| 32 |
/*if (callbackMasterEna() && m_useCb_endparse) {
|
| 33 |
cbFileline(fl);
|
| 34 |
static string hold1; hold1 = text;
|
| 35 |
call(NULL, 1, "endparse", hold1.c_str());
|
| 36 |
}*/
|
| 37 |
std::cout << "My_Parser::endparseCb called" << std::endl;
|
| 38 |
} |
| 39 |
|
| 40 |
void My_Parser::keywordCb(VFileLine* fl, const string& text) { |
| 41 |
/*if (callbackMasterEna() && m_useCb_keyword) {
|
| 42 |
cbFileline(fl);
|
| 43 |
static string hold1; hold1 = text;
|
| 44 |
call(NULL, 1, "keyword", hold1.c_str());
|
| 45 |
}*/
|
| 46 |
std::cout << "My_Parser::keywordCb called" << std::endl;
|
| 47 |
} |
| 48 |
|
| 49 |
void My_Parser::numberCb(VFileLine* fl, const string& text) { |
| 50 |
/*if (callbackMasterEna() && m_useCb_number) {
|
| 51 |
cbFileline(fl);
|
| 52 |
static string hold1; hold1 = text;
|
| 53 |
call(NULL, 1, "number", hold1.c_str());
|
| 54 |
}*/
|
| 55 |
std::cout << "My_Parser::numberCb called" << std::endl;
|
| 56 |
} |
| 57 |
|
| 58 |
void My_Parser::operatorCb(VFileLine* fl, const string& text) { |
| 59 |
/*if (callbackMasterEna() && m_useCb_operator) {
|
| 60 |
cbFileline(fl);
|
| 61 |
static string hold1; hold1 = text;
|
| 62 |
call(NULL, 1, "operator", hold1.c_str());
|
| 63 |
}*/
|
| 64 |
std::cout << "My_Parser::operatorCb called" << std::endl;
|
| 65 |
} |
| 66 |
|
| 67 |
void My_Parser::preprocCb(VFileLine* fl, const string& text) { |
| 68 |
/*if (callbackMasterEna() && m_useCb_preproc) {
|
| 69 |
cbFileline(fl);
|
| 70 |
static string hold1; hold1 = text;
|
| 71 |
call(NULL, 1, "preproc", hold1.c_str());
|
| 72 |
}*/
|
| 73 |
std::cout << "My_Parser::preprocCb called" << std::endl;
|
| 74 |
} |
| 75 |
|
| 76 |
void My_Parser::stringCb(VFileLine* fl, const string& text) { |
| 77 |
/*if (callbackMasterEna() && m_useCb_string) {
|
| 78 |
cbFileline(fl);
|
| 79 |
static string hold1; hold1 = text;
|
| 80 |
call(NULL, 1, "string", hold1.c_str());
|
| 81 |
}*/
|
| 82 |
std::cout << "My_Parser::stringCb called" << std::endl;
|
| 83 |
} |
| 84 |
|
| 85 |
void My_Parser::symbolCb(VFileLine* fl, const string& text) { |
| 86 |
/*if (callbackMasterEna() && m_useCb_symbol) {
|
| 87 |
cbFileline(fl);
|
| 88 |
static string hold1; hold1 = text;
|
| 89 |
call(NULL, 1, "symbol", hold1.c_str());
|
| 90 |
}*/
|
| 91 |
std::cout << "My_Parser::symbolCb called" << std::endl;
|
| 92 |
} |
| 93 |
|
| 94 |
void My_Parser::sysfuncCb(VFileLine* fl, const string& text) { |
| 95 |
// if (callbackMasterEna() && m_useCb_sysfunc) {
|
| 96 |
// cbFileline(fl);
|
| 97 |
// static string hold1; hold1 = text;
|
| 98 |
// call(NULL, 1, "sysfunc", hold1.c_str());
|
| 99 |
// }
|
| 100 |
std::cout << "My_Parser::sysfuncCb called" << std::endl;
|
| 101 |
} |
| 102 |
|
| 103 |
void My_Parser::classCb(VFileLine* fl, const string& kwd, const string& name, const string& virt) { |
| 104 |
// if (callbackMasterEna() && m_useCb_class) {
|
| 105 |
cbFileline(fl); |
| 106 |
static string hold1; hold1 = kwd; |
| 107 |
static string hold2; hold2 = name; |
| 108 |
static string hold3; hold3 = virt; |
| 109 |
// call(NULL, 3, "class", hold1.c_str(), hold2.c_str(), hold3.c_str());
|
| 110 |
// }
|
| 111 |
std::cout << "My_Parser::classCb called kwd " << kwd << " name: " << name << " virt: " << virt << std::endl; |
| 112 |
} |
| 113 |
|
| 114 |
void My_Parser::contassignCb(VFileLine* fl, const string& kwd, const string& lhs, const string& rhs) { |
| 115 |
// if (callbackMasterEna() && m_useCb_contassign) {
|
| 116 |
// cbFileline(fl);
|
| 117 |
// static string hold1; hold1 = kwd;
|
| 118 |
// static string hold2; hold2 = lhs;
|
| 119 |
// static string hold3; hold3 = rhs;
|
| 120 |
// call(NULL, 3, "contassign", hold1.c_str(), hold2.c_str(), hold3.c_str());
|
| 121 |
// }
|
| 122 |
std::cout << "My_Parser::contassignCb called" << std::endl;
|
| 123 |
} |
| 124 |
|
| 125 |
void My_Parser::covergroupCb(VFileLine* fl, const string& kwd, const string& name) { |
| 126 |
// if (callbackMasterEna() && m_useCb_covergroup) {
|
| 127 |
// cbFileline(fl);
|
| 128 |
// static string hold1; hold1 = kwd;
|
| 129 |
// static string hold2; hold2 = name;
|
| 130 |
// call(NULL, 2, "covergroup", hold1.c_str(), hold2.c_str());
|
| 131 |
// }
|
| 132 |
std::cout << "My_Parser::covergroupCb called" << std::endl;
|
| 133 |
} |
| 134 |
|
| 135 |
void My_Parser::defparamCb(VFileLine* fl, const string& kwd, const string& lhs, const string& rhs) { |
| 136 |
// if (callbackMasterEna() && m_useCb_defparam) {
|
| 137 |
// cbFileline(fl);
|
| 138 |
// static string hold1; hold1 = kwd;
|
| 139 |
// static string hold2; hold2 = lhs;
|
| 140 |
// static string hold3; hold3 = rhs;
|
| 141 |
// call(NULL, 3, "defparam", hold1.c_str(), hold2.c_str(), hold3.c_str());
|
| 142 |
// }
|
| 143 |
std::cout << "My_Parser::defparamCb called" << std::endl;
|
| 144 |
} |
| 145 |
|
| 146 |
void My_Parser::endcellCb(VFileLine* fl, const string& kwd) { |
| 147 |
// if (callbackMasterEna() && m_useCb_endcell) {
|
| 148 |
// cbFileline(fl);
|
| 149 |
// static string hold1; hold1 = kwd;
|
| 150 |
// call(NULL, 1, "endcell", hold1.c_str());
|
| 151 |
// }
|
| 152 |
std::cout << "My_Parser::endcellCb called" << std::endl;
|
| 153 |
} |
| 154 |
|
| 155 |
void My_Parser::endclassCb(VFileLine* fl, const string& kwd) { |
| 156 |
// if (callbackMasterEna() && m_useCb_endclass) {
|
| 157 |
// cbFileline(fl);
|
| 158 |
// static string hold1; hold1 = kwd;
|
| 159 |
// call(NULL, 1, "endclass", hold1.c_str());
|
| 160 |
// }
|
| 161 |
std::cout << "My_Parser::endclassCb called" << std::endl;
|
| 162 |
} |
| 163 |
|
| 164 |
void My_Parser::endgroupCb(VFileLine* fl, const string& kwd) { |
| 165 |
// if (callbackMasterEna() && m_useCb_endgroup) {
|
| 166 |
// cbFileline(fl);
|
| 167 |
// static string hold1; hold1 = kwd;
|
| 168 |
// call(NULL, 1, "endgroup", hold1.c_str());
|
| 169 |
// }
|
| 170 |
std::cout << "My_Parser::endgroupCb called" << std::endl;
|
| 171 |
} |
| 172 |
|
| 173 |
void My_Parser::endinterfaceCb(VFileLine* fl, const string& kwd) { |
| 174 |
// if (callbackMasterEna() && m_useCb_endinterface) {
|
| 175 |
// cbFileline(fl);
|
| 176 |
// static string hold1; hold1 = kwd;
|
| 177 |
// call(NULL, 1, "endinterface", hold1.c_str());
|
| 178 |
// }
|
| 179 |
std::cout << "My_Parser::endinterfaceCb called" << std::endl;
|
| 180 |
} |
| 181 |
|
| 182 |
void My_Parser::endmodportCb(VFileLine* fl, const string& kwd) { |
| 183 |
// if (callbackMasterEna() && m_useCb_endmodport) {
|
| 184 |
// cbFileline(fl);
|
| 185 |
// static string hold1; hold1 = kwd;
|
| 186 |
// call(NULL, 1, "endmodport", hold1.c_str());
|
| 187 |
// }
|
| 188 |
std::cout << "My_Parser::endmodportCb called" << std::endl;
|
| 189 |
} |
| 190 |
|
| 191 |
void My_Parser::endmoduleCb(VFileLine* fl, const string& kwd) { |
| 192 |
// if (callbackMasterEna() && m_useCb_endmodule) {
|
| 193 |
// cbFileline(fl);
|
| 194 |
// static string hold1; hold1 = kwd;
|
| 195 |
// call(NULL, 1, "endmodule", hold1.c_str());
|
| 196 |
// }
|
| 197 |
std::cout << "My_Parser::endmoduleCb called" << std::endl;
|
| 198 |
} |
| 199 |
|
| 200 |
void My_Parser::endpackageCb(VFileLine* fl, const string& kwd) { |
| 201 |
// if (callbackMasterEna() && m_useCb_endpackage) {
|
| 202 |
// cbFileline(fl);
|
| 203 |
// static string hold1; hold1 = kwd;
|
| 204 |
// call(NULL, 1, "endpackage", hold1.c_str());
|
| 205 |
// }
|
| 206 |
std::cout << "My_Parser::endpackageCb called" << std::endl;
|
| 207 |
} |
| 208 |
|
| 209 |
void My_Parser::endprogramCb(VFileLine* fl, const string& kwd) { |
| 210 |
// if (callbackMasterEna() && m_useCb_endprogram) {
|
| 211 |
// cbFileline(fl);
|
| 212 |
// static string hold1; hold1 = kwd;
|
| 213 |
// call(NULL, 1, "endprogram", hold1.c_str());
|
| 214 |
// }
|
| 215 |
std::cout << "My_Parser::endprogramCb called" << std::endl;
|
| 216 |
} |
| 217 |
|
| 218 |
void My_Parser::endtaskfuncCb(VFileLine* fl, const string& kwd) { |
| 219 |
// if (callbackMasterEna() && m_useCb_endtaskfunc) {
|
| 220 |
// cbFileline(fl);
|
| 221 |
// static string hold1; hold1 = kwd;
|
| 222 |
// call(NULL, 1, "endtaskfunc", hold1.c_str());
|
| 223 |
// }
|
| 224 |
std::cout << "My_Parser::endtaskfuncCb called" << std::endl;
|
| 225 |
} |
| 226 |
|
| 227 |
void My_Parser::functionCb(VFileLine* fl, const string& kwd, const string& name, const string& data_type) { |
| 228 |
// if (callbackMasterEna() && m_useCb_function) {
|
| 229 |
cbFileline(fl); |
| 230 |
static string hold1; hold1 = kwd; |
| 231 |
static string hold2; hold2 = name; |
| 232 |
static string hold3; hold3 = data_type; |
| 233 |
// call(NULL, 3, "function", hold1.c_str(), hold2.c_str(), hold3.c_str());
|
| 234 |
// }
|
| 235 |
std::cout << "My_Parser::functionCb called, name: " << name << " data_type: " << data_type << std::endl; |
| 236 |
} |
| 237 |
|
| 238 |
void My_Parser::importCb(VFileLine* fl, const string& package, const string& id) { |
| 239 |
// if (callbackMasterEna() && m_useCb_import) {
|
| 240 |
// cbFileline(fl);
|
| 241 |
// static string hold1; hold1 = package;
|
| 242 |
// static string hold2; hold2 = id;
|
| 243 |
// call(NULL, 2, "import", hold1.c_str(), hold2.c_str());
|
| 244 |
// }
|
| 245 |
std::cout << "My_Parser::importCb called" << std::endl;
|
| 246 |
} |
| 247 |
|
| 248 |
void My_Parser::instantCb(VFileLine* fl, const string& mod, const string& cell, const string& range) { |
| 249 |
// if (callbackMasterEna() && m_useCb_instant) {
|
| 250 |
// cbFileline(fl);
|
| 251 |
// static string hold1; hold1 = mod;
|
| 252 |
// static string hold2; hold2 = cell;
|
| 253 |
// static string hold3; hold3 = range;
|
| 254 |
// call(NULL, 3, "instant", hold1.c_str(), hold2.c_str(), hold3.c_str());
|
| 255 |
// }
|
| 256 |
std::cout << "My_Parser::instantCb called" << std::endl;
|
| 257 |
} |
| 258 |
|
| 259 |
void My_Parser::interfaceCb(VFileLine* fl, const string& kwd, const string& name) { |
| 260 |
// if (callbackMasterEna() && m_useCb_interface) {
|
| 261 |
// cbFileline(fl);
|
| 262 |
// static string hold1; hold1 = kwd;
|
| 263 |
// static string hold2; hold2 = name;
|
| 264 |
// call(NULL, 2, "interface", hold1.c_str(), hold2.c_str());
|
| 265 |
// }
|
| 266 |
std::cout << "My_Parser::interfaceCb called" << std::endl;
|
| 267 |
} |
| 268 |
|
| 269 |
void My_Parser::modportCb(VFileLine* fl, const string& kwd, const string& name) { |
| 270 |
// if (callbackMasterEna() && m_useCb_modport) {
|
| 271 |
// cbFileline(fl);
|
| 272 |
// static string hold1; hold1 = kwd;
|
| 273 |
// static string hold2; hold2 = name;
|
| 274 |
// call(NULL, 2, "modport", hold1.c_str(), hold2.c_str());
|
| 275 |
// }
|
| 276 |
std::cout << "My_Parser::modportCb called" << std::endl;
|
| 277 |
} |
| 278 |
|
| 279 |
void My_Parser::moduleCb(VFileLine* fl, const string& kwd, const string& name, bool, bool celldefine) { |
| 280 |
// if (callbackMasterEna() && m_useCb_module) {
|
| 281 |
cbFileline(fl); |
| 282 |
static string hold1; hold1 = kwd; |
| 283 |
static string hold2; hold2 = name; |
| 284 |
static string hold4; hold4 = celldefine ? "1":"0"; |
| 285 |
// call(NULL, 4, "module", hold1.c_str(), hold2.c_str(), NULL, hold4.c_str());
|
| 286 |
// }
|
| 287 |
std::cout << "My_Parser::moduleCb called, name: " << name << std::endl;
|
| 288 |
} |
| 289 |
|
| 290 |
void My_Parser::packageCb(VFileLine* fl, const string& kwd, const string& name) { |
| 291 |
// if (callbackMasterEna() && m_useCb_package) {
|
| 292 |
// cbFileline(fl);
|
| 293 |
// static string hold1; hold1 = kwd;
|
| 294 |
// static string hold2; hold2 = name;
|
| 295 |
// call(NULL, 2, "package", hold1.c_str(), hold2.c_str());
|
| 296 |
// }
|
| 297 |
std::cout << "My_Parser::packageCb called" << std::endl;
|
| 298 |
} |
| 299 |
|
| 300 |
void My_Parser::parampinCb(VFileLine* fl, const string& name, const string& conn, int index) { |
| 301 |
// if (callbackMasterEna() && m_useCb_parampin) {
|
| 302 |
// cbFileline(fl);
|
| 303 |
// static string hold1; hold1 = name;
|
| 304 |
// static string hold2; hold2 = conn;
|
| 305 |
// static string hold3; static char num3[30]; sprintf(num3,"%d",index); hold3=num3;
|
| 306 |
// call(NULL, 3, "parampin", hold1.c_str(), hold2.c_str(), hold3.c_str());
|
| 307 |
// }
|
| 308 |
std::cout << "My_Parser::parampinCb called" << std::endl;
|
| 309 |
} |
| 310 |
|
| 311 |
void My_Parser::pinCb(VFileLine* fl, const string& name, const string& conn, int index) { |
| 312 |
// if (callbackMasterEna() && m_useCb_pin) {
|
| 313 |
// cbFileline(fl);
|
| 314 |
// static string hold1; hold1 = name;
|
| 315 |
// static string hold2; hold2 = conn;
|
| 316 |
// static string hold3; static char num3[30]; sprintf(num3,"%d",index); hold3=num3;
|
| 317 |
// call(NULL, 3, "pin", hold1.c_str(), hold2.c_str(), hold3.c_str());
|
| 318 |
// }
|
| 319 |
std::cout << "My_Parser::pinCb called" << std::endl;
|
| 320 |
} |
| 321 |
|
| 322 |
void My_Parser::portCb(VFileLine* fl, const string& name, const string& objof, const string& direction, const string& data_type |
| 323 |
, const string& array, int index) { |
| 324 |
// if (callbackMasterEna() && m_useCb_port) {
|
| 325 |
cbFileline(fl); |
| 326 |
static string hold1; hold1 = name; |
| 327 |
static string hold2; hold2 = objof; |
| 328 |
static string hold3; hold3 = direction; |
| 329 |
static string hold4; hold4 = data_type; |
| 330 |
static string hold5; hold5 = array; |
| 331 |
static string hold6; static char num6[30]; sprintf(num6,"%d",index); hold6=num6; |
| 332 |
// call(NULL, 6, "port", hold1.c_str(), hold2.c_str(), hold3.c_str(), hold4.c_str(), hold5.c_str(), hold6.c_str());
|
| 333 |
// }
|
| 334 |
std::cout << "My_Parser::portCb called" << std::endl;
|
| 335 |
std::cout << "name: " << name << std::endl;
|
| 336 |
std::cout << "object of: " << objof << std::endl;
|
| 337 |
std::cout << "direction: " << direction << std::endl;
|
| 338 |
std::cout << "data_type: " << data_type << std::endl;
|
| 339 |
} |
| 340 |
|
| 341 |
void My_Parser::programCb(VFileLine* fl, const string& kwd, const string& name) { |
| 342 |
// if (callbackMasterEna() && m_useCb_program) {
|
| 343 |
// cbFileline(fl);
|
| 344 |
// static string hold1; hold1 = kwd;
|
| 345 |
// static string hold2; hold2 = name;
|
| 346 |
// call(NULL, 2, "program", hold1.c_str(), hold2.c_str());
|
| 347 |
// }
|
| 348 |
std::cout << "My_Parser::programCb called" << std::endl;
|
| 349 |
} |
| 350 |
|
| 351 |
void My_Parser::taskCb(VFileLine* fl, const string& kwd, const string& name) { |
| 352 |
// if (callbackMasterEna() && m_useCb_task) {
|
| 353 |
// cbFileline(fl);
|
| 354 |
// static string hold1; hold1 = kwd;
|
| 355 |
// static string hold2; hold2 = name;
|
| 356 |
// call(NULL, 2, "task", hold1.c_str(), hold2.c_str());
|
| 357 |
// }
|
| 358 |
std::cout << "My_Parser::taskCb called" << std::endl;
|
| 359 |
} |
| 360 |
|
| 361 |
void My_Parser::varCb(VFileLine* fl, const string& kwd, const string& name, const string& objof, const string& net |
| 362 |
, const string& data_type, const string& array, const string& value) { |
| 363 |
// if (callbackMasterEna() && m_useCb_var) {
|
| 364 |
cbFileline(fl); |
| 365 |
static string hold1; hold1 = kwd; |
| 366 |
static string hold2; hold2 = name; |
| 367 |
static string hold3; hold3 = objof; |
| 368 |
static string hold4; hold4 = net; |
| 369 |
static string hold5; hold5 = data_type; |
| 370 |
static string hold6; hold6 = array; |
| 371 |
static string hold7; hold7 = value; |
| 372 |
// call(NULL, 7, "var", hold1.c_str(), hold2.c_str(), hold3.c_str(), hold4.c_str(), hold5.c_str(), hold6.c_str(), hold7.c_str());
|
| 373 |
// }
|
| 374 |
std::cout << "My_Parser::varCb called" << std::endl;
|
| 375 |
std::cout << "name: " << name << std::endl;
|
| 376 |
std::cout << "object of: " << objof << std::endl;
|
| 377 |
std::cout << "net: " << net << std::endl;
|
| 378 |
std::cout << "data_type: " << data_type << std::endl;
|
| 379 |
std::cout << "value: " << value << std::endl;
|
| 380 |
} |
| 381 |
|
![[logo]](/img/veripool_small.png)