Leaked source code of windows server 2003
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.

122 lines
5.0 KiB

  1. //***************************************************************************
  2. //
  3. // SQLLEX.CPP
  4. //
  5. // SQL Level 1 DFA Table
  6. //
  7. // 24-Jun-95 Created.
  8. //
  9. //***************************************************************************
  10. #include <windows.h>
  11. #include <stdio.h>
  12. #include <genlex.h>
  13. #include <sqllex.h>
  14. #define ST_STRING 22
  15. #define ST_IDENT 27
  16. #define ST_GE 32
  17. #define ST_LE 34
  18. #define ST_NE 37
  19. #define ST_NUMERIC 39
  20. #define ST_REAL 42
  21. #define ST_STRING2 48
  22. #define ST_STRING_ESC 53
  23. #define ST_STRING2_ESC 54
  24. // DFA State Table for SQL Level 1 lexical symbols.
  25. // ================================================
  26. LexEl Sql_1_LexTable[] =
  27. {
  28. // State First Last New state, Return tok, Instructions
  29. // =======================================================================
  30. /* 0 */ L'A', L'Z', ST_IDENT, 0, GLEX_ACCEPT,
  31. /* 1 */ L'a', L'z', ST_IDENT, 0, GLEX_ACCEPT,
  32. /* 2 */ L'_', GLEX_EMPTY, ST_IDENT, 0, GLEX_ACCEPT,
  33. /* 3 */ L'(', GLEX_EMPTY, 0, SQL_1_TOK_OPEN_PAREN, GLEX_ACCEPT,
  34. /* 4 */ L')', GLEX_EMPTY, 0, SQL_1_TOK_CLOSE_PAREN, GLEX_ACCEPT,
  35. /* 5 */ L'.', GLEX_EMPTY, 0, SQL_1_TOK_DOT, GLEX_ACCEPT,
  36. /* 6 */ L'*', GLEX_EMPTY, 0, SQL_1_TOK_ASTERISK, GLEX_ACCEPT,
  37. /* 7 */ L'=', GLEX_EMPTY, 0, SQL_1_TOK_EQ, GLEX_ACCEPT,
  38. /* 8 */ L'>', GLEX_EMPTY, ST_GE, 0, GLEX_ACCEPT,
  39. /* 9 */ L'<', GLEX_EMPTY, ST_LE, 0, GLEX_ACCEPT,
  40. /* 10 */ L'0', L'9', ST_NUMERIC, 0, GLEX_ACCEPT,
  41. /* 11 */ L'"', GLEX_EMPTY, ST_STRING, 0, GLEX_CONSUME,
  42. /* 12 */ L'\'', GLEX_EMPTY, ST_STRING2, 0, GLEX_CONSUME,
  43. /* 13 */ L'!', GLEX_EMPTY, ST_NE, 0, GLEX_ACCEPT,
  44. /* 14 */ L'-', GLEX_EMPTY, ST_NUMERIC, 0, GLEX_ACCEPT,
  45. // Whitespace, newlines, etc.
  46. /* 15 */ L' ', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  47. /* 16 */ L'\t', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  48. /* 17 */ L'\n', GLEX_EMPTY, 0, 0, GLEX_CONSUME|GLEX_LINEFEED,
  49. /* 18 */ L'\r', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  50. /* 19 */ 0, GLEX_EMPTY, 0, SQL_1_TOK_EOF, GLEX_CONSUME|GLEX_RETURN, // Note forced return
  51. /* 20 */ L',', GLEX_EMPTY, 0, SQL_1_TOK_COMMA, GLEX_ACCEPT,
  52. // Unknown characters
  53. /* 21 */ GLEX_ANY, GLEX_EMPTY, 0, SQL_1_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  54. // ST_STRING
  55. /* 22 */ L'\n', GLEX_EMPTY, 0, SQL_1_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  56. /* 23 */ L'\r', GLEX_EMPTY, 0, SQL_1_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  57. /* 24 */ L'"', GLEX_EMPTY, 0, SQL_1_TOK_QSTRING, GLEX_CONSUME,
  58. /* 25 */ L'\\', GLEX_EMPTY, ST_STRING_ESC, 0, GLEX_CONSUME,
  59. /* 26 */ GLEX_ANY, GLEX_EMPTY, ST_STRING, 0, GLEX_ACCEPT,
  60. // ST_IDENT
  61. /* 27 */ L'a', L'z', ST_IDENT, 0, GLEX_ACCEPT,
  62. /* 28 */ L'A', L'Z', ST_IDENT, 0, GLEX_ACCEPT,
  63. /* 29 */ L'_', GLEX_EMPTY, ST_IDENT, 0, GLEX_ACCEPT,
  64. /* 30 */ L'0', L'9', ST_IDENT, 0, GLEX_ACCEPT,
  65. /* 31 */ GLEX_ANY, GLEX_EMPTY, 0, SQL_1_TOK_IDENT, GLEX_PUSHBACK|GLEX_RETURN,
  66. // ST_GE
  67. /* 32 */ L'=', GLEX_EMPTY, 0, SQL_1_TOK_GE, GLEX_ACCEPT,
  68. /* 33 */ GLEX_ANY, GLEX_EMPTY, 0, SQL_1_TOK_GT, GLEX_PUSHBACK|GLEX_RETURN,
  69. // ST_LE
  70. /* 34 */ L'=', GLEX_EMPTY, 0, SQL_1_TOK_LE, GLEX_ACCEPT,
  71. /* 35 */ L'>', GLEX_EMPTY, 0, SQL_1_TOK_NE, GLEX_ACCEPT,
  72. /* 36 */ GLEX_ANY, GLEX_EMPTY, 0, SQL_1_TOK_LT, GLEX_PUSHBACK|GLEX_RETURN,
  73. // ST_NE
  74. /* 37 */ L'=', GLEX_EMPTY, 0, SQL_1_TOK_NE, GLEX_ACCEPT,
  75. /* 38 */ GLEX_ANY, GLEX_EMPTY, 0, SQL_1_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  76. // ST_NUMERIC
  77. /* 39 */ L'0', L'9', ST_NUMERIC, 0, GLEX_ACCEPT,
  78. /* 40 */ L'.', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  79. /* 41 */ GLEX_ANY, GLEX_EMPTY, 0, SQL_1_TOK_INT, GLEX_PUSHBACK|GLEX_RETURN,
  80. // ST_REAL
  81. /* 42 */ L'0', L'9', ST_REAL, 0, GLEX_ACCEPT,
  82. /* 43 */ L'E', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  83. /* 44 */ L'e', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  84. /* 45 */ L'+', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  85. /* 46 */ L'-', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  86. /* 47 */ GLEX_ANY, GLEX_EMPTY, 0, SQL_1_TOK_REAL, GLEX_PUSHBACK|GLEX_RETURN,
  87. // ST_STRING2
  88. /* 48 */ L'\n', GLEX_EMPTY, 0, SQL_1_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  89. /* 49 */ L'\r', GLEX_EMPTY, 0, SQL_1_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  90. /* 50 */ L'\'', GLEX_EMPTY, 0, SQL_1_TOK_QSTRING, GLEX_CONSUME,
  91. /* 51 */ L'\\', GLEX_EMPTY, ST_STRING2_ESC, 0, GLEX_CONSUME,
  92. /* 52 */ GLEX_ANY, GLEX_EMPTY, ST_STRING2, 0, GLEX_ACCEPT,
  93. // ST_STRING_ESC
  94. /* 53 */ GLEX_ANY, GLEX_EMPTY, ST_STRING, 0, GLEX_ACCEPT,
  95. // ST_STRING2_ESC
  96. /* 54 */ GLEX_ANY, GLEX_EMPTY, ST_STRING2, 0, GLEX_ACCEPT,
  97. };