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.

160 lines
6.5 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  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 27
  16. #define ST_IDENT 32
  17. #define ST_GE 38
  18. #define ST_LE 40
  19. #define ST_NE 43
  20. #define ST_NUMERIC 45
  21. #define ST_REAL 48
  22. #define ST_STRING2 50
  23. #define ST_STRING_ESC 55
  24. #define ST_STRING2_ESC 58
  25. #define ST_DOT 61
  26. #define ST_PROMPT 63
  27. #define ST_PROMPT_END 69
  28. #define ST_PROMPT_ESC 71
  29. // DFA State Table for QL Level 1 lexical symbols.
  30. // ================================================
  31. LexEl WQL_LexTable[] =
  32. {
  33. // State First Last New state, Return tok, Instructions
  34. // =======================================================================
  35. /* 0 */ L'A', L'Z', ST_IDENT, 0, GLEX_ACCEPT,
  36. /* 1 */ L'a', L'z', ST_IDENT, 0, GLEX_ACCEPT,
  37. /* 2 */ L'_', GLEX_EMPTY, ST_IDENT, 0, GLEX_ACCEPT,
  38. /* 3 */ 0x80, 0xfffd, ST_IDENT, 0, GLEX_ACCEPT,
  39. /* 4 */ L'(', GLEX_EMPTY, 0, WQL_TOK_OPEN_PAREN, GLEX_ACCEPT,
  40. /* 5 */ L')', GLEX_EMPTY, 0, WQL_TOK_CLOSE_PAREN, GLEX_ACCEPT,
  41. /* 6 */ L'.', GLEX_EMPTY, ST_DOT, 0, GLEX_ACCEPT,
  42. /* 7 */ L'*', GLEX_EMPTY, 0, WQL_TOK_ASTERISK, GLEX_ACCEPT,
  43. /* 8 */ L'=', GLEX_EMPTY, 0, WQL_TOK_EQ, GLEX_ACCEPT,
  44. /* 9 */ L'[', GLEX_EMPTY, 0, WQL_TOK_OPEN_BRACKET, GLEX_ACCEPT,
  45. /* 10 */ L']', GLEX_EMPTY, 0, WQL_TOK_CLOSE_BRACKET, GLEX_ACCEPT,
  46. /* 11 */ L'>', GLEX_EMPTY, ST_GE, 0, GLEX_ACCEPT,
  47. /* 12 */ L'<', GLEX_EMPTY, ST_LE, 0, GLEX_ACCEPT,
  48. /* 13 */ L'0', L'9', ST_NUMERIC, 0, GLEX_ACCEPT,
  49. /* 14 */ L'"', GLEX_EMPTY, ST_STRING, 0, GLEX_CONSUME,
  50. /* 15 */ L'\'', GLEX_EMPTY, ST_STRING2, 0, GLEX_CONSUME,
  51. /* 16 */ L'!', GLEX_EMPTY, ST_NE, 0, GLEX_ACCEPT,
  52. /* 17 */ L'-', GLEX_EMPTY, ST_NUMERIC, 0, GLEX_ACCEPT,
  53. /* 18 */ L'\'', GLEX_EMPTY, ST_STRING2, 0, GLEX_CONSUME, // never
  54. // Whitespace, newlines, etc.
  55. /* 19 */ L' ', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  56. /* 20 */ L'\t', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  57. /* 21 */ L'\n', GLEX_EMPTY, 0, 0, GLEX_CONSUME|GLEX_LINEFEED,
  58. /* 22 */ L'\r', GLEX_EMPTY, 0, 0, GLEX_CONSUME,
  59. /* 23 */ 0, GLEX_EMPTY, 0, WQL_TOK_EOF, GLEX_CONSUME|GLEX_RETURN, // Note forced return
  60. /* 24 */ L',', GLEX_EMPTY, 0, WQL_TOK_COMMA, GLEX_ACCEPT,
  61. // Prompt user for constant
  62. /* 25 */ L'#', GLEX_EMPTY, ST_PROMPT, 0, GLEX_CONSUME,
  63. // Unknown characters
  64. /* 26 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  65. // ST_STRING
  66. /* 27 */ L'\n', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  67. /* 28 */ L'\r', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT,
  68. /* 29 */ L'"', GLEX_EMPTY, 0, WQL_TOK_QSTRING, GLEX_CONSUME,
  69. /* 30 */ L'\\', GLEX_EMPTY, ST_STRING_ESC, 0, GLEX_CONSUME,
  70. /* 31 */ GLEX_ANY, GLEX_EMPTY, ST_STRING, 0, GLEX_ACCEPT,
  71. // ST_IDENT
  72. /* 32 */ L'a', L'z', ST_IDENT, 0, GLEX_ACCEPT,
  73. /* 33 */ L'A', L'Z', ST_IDENT, 0, GLEX_ACCEPT,
  74. /* 34 */ L'_', GLEX_EMPTY, ST_IDENT, 0, GLEX_ACCEPT,
  75. /* 35 */ L'0', L'9', ST_IDENT, 0, GLEX_ACCEPT,
  76. /* 36 */ 0x80, 0xfffd, ST_IDENT, 0, GLEX_ACCEPT,
  77. /* 37 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_IDENT, GLEX_PUSHBACK|GLEX_RETURN,
  78. // ST_GE
  79. /* 38 */ L'=', GLEX_EMPTY, 0, WQL_TOK_GE, GLEX_ACCEPT,
  80. /* 39 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_GT, GLEX_PUSHBACK|GLEX_RETURN,
  81. // ST_LE
  82. /* 40 */ L'=', GLEX_EMPTY, 0, WQL_TOK_LE, GLEX_ACCEPT,
  83. /* 41 */ L'>', GLEX_EMPTY, 0, WQL_TOK_NE, GLEX_ACCEPT,
  84. /* 42 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_LT, GLEX_PUSHBACK|GLEX_RETURN,
  85. // ST_NE
  86. /* 43 */ L'=', GLEX_EMPTY, 0, WQL_TOK_NE, GLEX_ACCEPT,
  87. /* 44 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  88. // ST_NUMERIC
  89. /* 45 */ L'0', L'9', ST_NUMERIC, 0, GLEX_ACCEPT,
  90. /* 46 */ L'.', GLEX_EMPTY, ST_REAL, 0, GLEX_ACCEPT,
  91. /* 47 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_INT, GLEX_PUSHBACK|GLEX_RETURN,
  92. // ST_REAL
  93. /* 48 */ L'0', L'9', ST_REAL, 0, GLEX_ACCEPT,
  94. /* 49 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_REAL, GLEX_PUSHBACK|GLEX_RETURN,
  95. // ST_STRING2
  96. /* 50 */ L'\n', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_LINEFEED,
  97. /* 51 */ L'\r', GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT,
  98. /* 52 */ L'\'', GLEX_EMPTY, 0, WQL_TOK_QSTRING, GLEX_CONSUME,
  99. /* 53 */ L'\\', GLEX_EMPTY, ST_STRING2_ESC, 0, GLEX_CONSUME,
  100. /* 54 */ GLEX_ANY, GLEX_EMPTY, ST_STRING2, 0, GLEX_ACCEPT,
  101. // ST_STRING_ESC
  102. /* 55 */ L'"', GLEX_EMPTY, ST_STRING, 0, GLEX_ACCEPT,
  103. /* 56 */ L'\\', GLEX_EMPTY, ST_STRING, 0, GLEX_ACCEPT,
  104. /* 57 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  105. // ST_STRING2_ESC
  106. /* 58 */ L'\'', GLEX_EMPTY, ST_STRING2, 0, GLEX_ACCEPT,
  107. /* 59 */ L'\\', GLEX_EMPTY, ST_STRING2, 0, GLEX_ACCEPT,
  108. /* 60 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_ACCEPT|GLEX_RETURN,
  109. // ST_DOT
  110. /* 61 */ L'0', L'9', ST_REAL, 0, GLEX_ACCEPT,
  111. /* 62 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_DOT, GLEX_PUSHBACK|GLEX_RETURN,
  112. // ST_PROMPT
  113. /* 63 */ L'\n', GLEX_EMPTY, ST_PROMPT, 0, GLEX_ACCEPT|GLEX_LINEFEED,
  114. /* 64 */ L'\r', GLEX_EMPTY, ST_PROMPT, 0, GLEX_ACCEPT,
  115. /* 65 */ L'\\', GLEX_EMPTY, ST_PROMPT_ESC, 0, GLEX_CONSUME,
  116. /* 66 */ L'#', GLEX_EMPTY, ST_PROMPT_END, 0, GLEX_ACCEPT,
  117. /* 67 */ 0, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_PUSHBACK|GLEX_RETURN, // Note forced return
  118. /* 68 */ GLEX_ANY, GLEX_EMPTY, ST_PROMPT, 0, GLEX_ACCEPT,
  119. // ST_PROMPT_END
  120. /* 69 */ L'#', GLEX_EMPTY, 0, WQL_TOK_PROMPT, GLEX_CONSUME,
  121. /* 70 */ GLEX_ANY, GLEX_EMPTY, ST_PROMPT, 0, GLEX_PUSHBACK,
  122. // ST_PROMPT_ESC
  123. /* 71 */ L'#', GLEX_EMPTY, ST_PROMPT, 0, GLEX_ACCEPT,
  124. /* 72 */ L'\\', GLEX_EMPTY, ST_PROMPT, 0, GLEX_ACCEPT,
  125. /* 73 */ GLEX_ANY, GLEX_EMPTY, 0, WQL_TOK_ERROR, GLEX_PUSHBACK|GLEX_RETURN,
  126. };