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.

178 lines
7.7 KiB

  1. /*++
  2. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  3. Module Name:
  4. WQLLEX.CPP
  5. Abstract:
  6. WQL DFA Table
  7. History:
  8. raymcc 14-Sep-97 Created.
  9. raymcc 06-Oct-97 Single quote support
  10. --*/
  11. #include "precomp.h"
  12. #include <stdio.h>
  13. #include <genlex.h>
  14. #include <wqllex.h>
  15. #define ST_STRING 29
  16. #define ST_IDENT 34
  17. #define ST_GE 40
  18. #define ST_LE 42
  19. #define ST_NE 45
  20. #define ST_NUMERIC 47
  21. #define ST_REAL 54
  22. #define ST_STRING2 60
  23. #define ST_STRING_ESC 65
  24. #define ST_STRING2_ESC 66
  25. #define ST_SSTRING 67
  26. #define ST_DOT 71
  27. #define ST_BRACKETED_STR 74
  28. #define ST_NEGATIVE_NUM 76
  29. #define ST_POSITIVE_NUM 79
  30. #define ST_HEX_CONST 82
  31. // DFA State Table for QL Level 1 lexical symbols.
  32. // ================================================
  33. LexEl WQL_LexTable[] =
  34. {
  35. // State First Last New state, Return tok, Instructions
  36. // =======================================================================
  37. /* 0 */ L'A', L'Z', ST_IDENT, 0, GLEX_ACCEPT,
  38. /* 1 */ L'a', L'z', ST_IDENT, 0, GLEX_ACCEPT,
  39. /* 2 */ L'_', GLEX_EMPTY, ST_IDENT, 0, GLEX_ACCEPT,
  40. /* 3 */ 0x80, 0xfffd, ST_IDENT, 0, GLEX_ACCEPT,
  41. /* 4 */ L'(', GLEX_EMPTY, 0, WQL_TOK_OPEN_PAREN, GLEX_ACCEPT,
  42. /* 5 */ L')', GLEX_EMPTY, 0, WQL_TOK_CLOSE_PAREN, GLEX_ACCEPT,
  43. /* 6 */ L'.', GLEX_EMPTY, ST_DOT, 0, GLEX_ACCEPT,
  44. /* 7 */ L'*', GLEX_EMPTY, 0, WQL_TOK_ASTERISK, GLEX_ACCEPT,
  45. /* 8 */ L'=', GLEX_EMPTY, 0, WQL_TOK_EQ, GLEX_ACCEPT,
  46. /* 9 */ L'[', GLEX_EMPTY, ST_BRACKETED_STR, 0, GLEX_CONSUME,
  47. /* 10 */ L']', GLEX_EMPTY, 0, WQL_TOK_CLOSE_BRACKET, GLEX_ACCEPT,
  48. /* 11 */ L'{', GLEX_EMPTY, 0, WQL_TOK_OPEN_BRACE, GLEX_ACCEPT,
  49. /* 12 */ L'}', GLEX_EMPTY, 0, WQL_TOK_CLOSE_BRACE, GLEX_ACCEPT,
  50. /* 13 */ L'>', GLEX_EMPTY, ST_GE, 0, GLEX_ACCEPT,
  51. /* 14 */ L'<', GLEX_EMPTY, ST_LE, 0, GLEX_ACCEPT,
  52. /* 15 */ L'0', L'9', ST_NUMERIC, 0, GLEX_ACCEPT,
  53. /* 16 */ L'"', GLEX_EMPTY, ST_STRING, 0, GLEX_CONSUME,
  54. /* 17 */ L'\'', GLEX_EMPTY, ST_STRING2, 0, GLEX_CONSUME,
  55. /* 18 */ L'!', GLEX_EMPTY, ST_NE, 0, GLEX_ACCEPT,
  56. /* 19 */ L'-', GLEX_EMPTY, ST_NEGATIVE_NUM, 0, GLEX_ACCEPT,
  57. /* 20 */ L'\'', GLEX_EMPTY, ST_SSTRING, 0, GLEX_CONSUME,
  58. // Whitespace, newlines, etc.
  59. /* 21 */ L' ', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  60. /* 22 */ L'\t', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  61. /* 23 */ L'\n', GLEX_EMPTY, 0, 0, GLEX_CONSUME|GLEX_LINEFEED,
  62. /* 24 */ L'\r', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  63. /* 25 */ 0, GLEX_EMPTY, 0, WQL_TOK_EOF, GLEX_CONSUME|GLEX_RETURN, // Note forced return
  64. /* 26 */ L',', GLEX_EMPTY, 0, WQL_TOK_COMMA, GLEX_ACCEPT,
  65. /* 27 */ L'+', GLEX_EMPTY, ST_POSITIVE_NUM, 0, GLEX_CONSUME,
  66. // Unknown characters
  67. /* 28 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  68. // ST_STRING
  69. /* 29 */ L'\n', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  70. /* 30 */ L'\r', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  71. /* 31 */ L'"', GLEX_EMPTY, 0, WQL_TOK_QSTRING, GLEX_CONSUME,
  72. /* 32 */ L'\\', GLEX_EMPTY, ST_STRING_ESC, 0, GLEX_CONSUME,
  73. /* 33 */ GLEX_ANY, GLEX_EMPTY, ST_STRING, 0, GLEX_ACCEPT,
  74. // ST_IDENT
  75. /* 34 */ L'a', L'z', ST_IDENT, 0, GLEX_ACCEPT,
  76. /* 35 */ L'A', L'Z', ST_IDENT, 0, GLEX_ACCEPT,
  77. /* 36 */ L'_', GLEX_EMPTY, ST_IDENT, 0, GLEX_ACCEPT,
  78. /* 37 */ L'0', L'9', ST_IDENT, 0, GLEX_ACCEPT,
  79. /* 38 */ 0x80, 0xfffd, ST_IDENT, 0, GLEX_ACCEPT,
  80. /* 39 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_IDENT, GLEX_PUSHBACK|GLEX_RETURN,
  81. // ST_GE
  82. /* 40 */ L'=', GLEX_EMPTY, 0, WQL_TOK_GE, GLEX_ACCEPT,
  83. /* 41 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_GT, GLEX_PUSHBACK|GLEX_RETURN,
  84. // ST_LE
  85. /* 42 */ L'=', GLEX_EMPTY, 0, WQL_TOK_LE, GLEX_ACCEPT,
  86. /* 43 */ L'>', GLEX_EMPTY, 0, WQL_TOK_NE, GLEX_ACCEPT,
  87. /* 44 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_LT, GLEX_PUSHBACK|GLEX_RETURN,
  88. // ST_NE
  89. /* 45 */ L'=', GLEX_EMPTY, 0, WQL_TOK_NE, GLEX_ACCEPT,
  90. /* 46 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  91. // ST_NUMERIC
  92. /* 47 */ L'0', L'9', ST_NUMERIC, 0, GLEX_ACCEPT,
  93. /* 48 */ L'.', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  94. /* 49 */ L'E', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  95. /* 50 */ L'e', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  96. /* 51 */ L'x', GLEX_EMPTY, ST_HEX_CONST, 0, GLEX_ACCEPT,
  97. /* 52 */ L'X', GLEX_EMPTY, ST_HEX_CONST, 0, GLEX_ACCEPT,
  98. /* 53 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_INT, GLEX_PUSHBACK|GLEX_RETURN,
  99. // ST_REAL
  100. /* 54 */ L'0', L'9', ST_REAL, 0, GLEX_ACCEPT,
  101. /* 55 */ L'E', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  102. /* 56 */ L'e', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  103. /* 57 */ L'+', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  104. /* 58 */ L'-', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  105. /* 59 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_REAL, GLEX_PUSHBACK|GLEX_RETURN,
  106. // ST_STRING2
  107. /* 60 */ L'\n', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  108. /* 61 */ L'\r', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  109. /* 62 */ L'\'', GLEX_EMPTY, 0, WQL_TOK_QSTRING, GLEX_CONSUME,
  110. /* 63 */ L'\\', GLEX_EMPTY, ST_STRING2_ESC, 0, GLEX_CONSUME,
  111. /* 64 */ GLEX_ANY, GLEX_EMPTY, ST_STRING2, 0, GLEX_ACCEPT,
  112. // ST_STRING_ESC
  113. /* 65 */ GLEX_ANY, GLEX_EMPTY, ST_STRING, 0, GLEX_ACCEPT,
  114. // ST_STRING2_ESC
  115. /* 66 */ GLEX_ANY, GLEX_EMPTY, ST_STRING2, 0, GLEX_ACCEPT,
  116. // ST_SSTRING (Single quoted strings)
  117. /* 67 */ L'\n', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  118. /* 68 */ L'\r', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  119. /* 69 */ L'\'', GLEX_EMPTY, 0, WQL_TOK_QSTRING, GLEX_CONSUME,
  120. /* 70 */ L'\\', GLEX_EMPTY, ST_STRING_ESC, 0, GLEX_CONSUME,
  121. /* 71 */ GLEX_ANY, GLEX_EMPTY, ST_STRING, 0, GLEX_ACCEPT,
  122. // ST_DOT
  123. /* 72 */ L'0', L'9', ST_REAL, 0, GLEX_ACCEPT,
  124. /* 73 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_DOT, GLEX_PUSHBACK|GLEX_RETURN,
  125. // ST_BRACKETED_STRING
  126. /* 74 */ L']', GLEX_EMPTY, 0, WQL_TOK_BRACKETED_STRING, GLEX_CONSUME,
  127. /* 75 */ GLEX_ANY, GLEX_EMPTY, ST_BRACKETED_STR, 0, GLEX_ACCEPT,
  128. // ST_NEGATIVE_NUM - Strips whitespace after '-'
  129. /* 76 */ L' ', GLEX_EMPTY, ST_NEGATIVE_NUM, 0, GLEX_CONSUME,
  130. /* 77 */ L'0', L'9', ST_NUMERIC, 0, GLEX_ACCEPT,
  131. /* 78 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  132. // ST_POSITIVE_NUM - Strips whitespace after '+'
  133. /* 79 */ L' ', GLEX_EMPTY, ST_POSITIVE_NUM, 0, GLEX_CONSUME,
  134. /* 80 */ L'0', L'9', ST_NUMERIC, 0, GLEX_ACCEPT,
  135. /* 81 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  136. // ST_HEX_CONST - Recognizes 0x hex constants
  137. /* 82 */ L'0', L'9', ST_HEX_CONST, 0, GLEX_ACCEPT,
  138. /* 83 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_HEX_CONST, GLEX_PUSHBACK|GLEX_RETURN,
  139. };
  140.