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.

130 lines
5.1 KiB

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