Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
957 B

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. WQLTEST.CPP
  5. Abstract:
  6. History:
  7. --*/
  8. #include "precomp.h"
  9. #include <stdio.h>
  10. #include <genlex.h>
  11. #include <flexarry.h>
  12. #include <wqllex.h>
  13. #include <wqlnode.h>
  14. #include <wqlscan.h>
  15. void xmain(int argc, char **argv)
  16. {
  17. if (argc < 2)
  18. {
  19. printf("No SQL query specified\n");
  20. return;
  21. }
  22. char buf[8192];
  23. FILE *f = fopen(argv[1], "rt");
  24. int nCnt = fread(buf, 1, 8192, f);
  25. fclose(f);
  26. buf[nCnt] = 0;
  27. wchar_t buf2[8192];
  28. MultiByteToWideChar(CP_ACP, 0, buf, -1, buf2, 8192);
  29. CTextLexSource src(buf2);
  30. CWQLScanner parser(&src);
  31. int nRes = parser.Parse();
  32. if (nRes)
  33. {
  34. printf("ERROR: %d\n", nRes);
  35. }
  36. else
  37. {
  38. printf("No errors.\n");
  39. parser.Dump();
  40. }
  41. }
  42. void main(int argc, char **argv)
  43. {
  44. for (;;)
  45. {
  46. Sleep(500);
  47. xmain(argc, argv);
  48. }
  49. }