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.

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