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.

156 lines
4.4 KiB

  1. This BNF strictly shows the syntax of the query language. While some
  2. semantic checking is done at the parser level, most of the real semantic
  3. checking goes on in the query engine.
  4. Query : QExpr
  5. | QExpr COMMA_TOKEN Query
  6. QExpr : QTerm
  7. | QTerm OR_TOKEN QExpr
  8. QTerm : (NOT_TOKEN) QProp (W_OPEN_TOKEN Weight W_CLOSE_TOKEN)
  9. | (NOT_TOKEN) QProp (W_OPEN_TOKEN Weight W_CLOSE_TOKEN) AND_TOKEN QTerm
  10. QProp : QFactor
  11. | PROP_TOKEN property QFactor
  12. | PROP_REGEX_TOKEN property (EQUAL_TOKEN) REGEX
  13. | PROP_NATLANG_TOKEN property QPhrase
  14. QFactor : QGroup
  15. | OPEN_TOKEN Query CLOSE_TOKEN
  16. | OP_TOKEN phrase
  17. QGroup : QPhrase
  18. | QPhrase PROX_TOKEN QProp
  19. QPhrase : phrase(FUZZY_TOKEN | FUZ2_TOKEN)
  20. | REGEX
  21. | QUOTES_TOKEN extended_phrase(FUZZY_TOKEN | FUZ2_TOKEN)
  22. property : phrase
  23. | C_OPEN_TOKEN ((phrase COMMA_TOKEN)*phrase) C_CLOSE_TOKEN
  24. Weight : DIGITS
  25. # Note: the branch taken for parsing a "phrase" depends on the data-type
  26. # of the current property.
  27. phrase : STRING_PHRASE
  28. | INTEGER_PHRASE
  29. | FLOAT_PHRASE
  30. | BOOL_PHRASE
  31. | DATE_PHRASE
  32. | CURRENCY_PHRASE
  33. | GUID_PHRASE
  34. STRING_PHRASE : ANY
  35. INTEGER_PHRASE : (-)DIGITS
  36. FLOAT_PHRASE : (-)DIGITS(.DIGITS)
  37. BOOL_PHRASE : T
  38. | TRUE
  39. | FALSE
  40. | ANY # -- assumed to be FALSE
  41. # yyyy/mm/dd hh:mm:ss
  42. DATE_PHRASE : -[DIGITS PERIOD]+
  43. | DIGITS/DIGITS/DIGITS
  44. | DIGITS/DIGITS/DIGITS DIGITS:DIGITS:DIGITS
  45. | DIGITS/DIGITS/DIGITS DIGITS:DIGITS:DIGITS:MILLISECONDS
  46. PERIOD : h | n | s | y | m | d | w
  47. CURRENCY_PHRASE : DIGITS.DIGITS # dollars.cents
  48. GUID_PHRASE : %08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X
  49. DIGITS : [0-9]+
  50. ANY : any sequence excluding {}!&|~*@#()[],=<>\n\"^$
  51. ANYEXCEPTQUOTE : any sequence excluding "
  52. # note: the real parsing of REGEX expressions is done in the query engine.
  53. # The parsing that the query parser does is just enough to hand off the
  54. # string to the query engine. The BNF for this is in the Query Language
  55. # Help page.
  56. REGEX : QUOTES_TOKEN ANYEXCEPTQUOTE QUOTES_TOKEN
  57. | any sequence before SPACE_TOKEN
  58. | any sequence before a ) not preceeded by a !
  59. # the XOF_TOKEN after OPERATOR here is only meaningful for vector properties
  60. OP_TOKEN : OPERATOR (XOF_TOKEN)
  61. OPERATOR : EQUAL_TOKEN
  62. | NOT_EQUAL_TOKEN
  63. | GREATER_TOKEN
  64. | GREATER_EQUAL_TOKEN
  65. | LESS_TOKEN
  66. | LESS_EQUAL_TOKEN
  67. | XOF_TOKEN
  68. XOF_TOKEN : ALLOF_TOKEN
  69. | SOMEOF_TOKEN
  70. C_OPEN_TOKEN : {
  71. C_CLOSE_TOKEN : }
  72. OPEN_TOKEN : (
  73. CLOSE_TOKEN : )
  74. AND_TOKEN : &
  75. | and
  76. OR_TOKEN : |
  77. | or
  78. NOT_TOKEN : !
  79. | not
  80. NOT_EQUAL_TOKEN : !=
  81. SPACE_TOKEN : ' '
  82. GREATER_TOKEN : >
  83. GREATER_EQUAL_TOKEN : >=
  84. LESS_TOKEN : <
  85. LESS_EQUAL_TOKEN : <=
  86. PROX_TOKEN : ~
  87. | near
  88. QUOTES_TOKEN : "
  89. PROP_TOKEN : @
  90. PROP_REGEX_TOKEN : #
  91. PROP_NATLANG_TOKEN : $
  92. EQUAL_TOKEN : =
  93. FUZZY_TOKEN : *
  94. FUZ2_TOKEY : **
  95. W_OPEN_TOKEN : [
  96. W_CLOSE_TOKEN : ]
  97. COMMA_TOKEN : ,
  98. ALLOF_TOKEN : ^a
  99. SOMEOF_TOKEN : ^s