Main.cpp 692 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <iostream>
  2. #include "File.h"
  3. #include "Tokenizer.h"
  4. #include "Exception.h"
  5. using namespace std;
  6. int main(int argc, char** argv)
  7. {
  8. File f("tests/if.snuvi");
  9. if(f.exists())
  10. {
  11. Tokenizer t(f.read());
  12. ArrayList<Token*> tokens;
  13. try
  14. {
  15. t.tokenize(tokens);
  16. }
  17. catch(Exception ex)
  18. {
  19. ex.print();
  20. }
  21. tokens.forEach([](Token* t)
  22. {
  23. cout << *t << endl;
  24. });
  25. tokens.forEach([](Token* t)
  26. {
  27. delete t;
  28. });
  29. tokens.clear();
  30. }
  31. else
  32. {
  33. cout << "no" << endl;
  34. }
  35. return 0;
  36. }