sqllogictest.tmLanguage.json 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {
  2. "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  3. "name": "SQL Logic Test",
  4. "patterns": [
  5. { "include": "#comment" },
  6. { "include": "#halt" },
  7. { "include": "#hash-threshold" },
  8. { "include": "#kv-batch-size" },
  9. { "include": "#mode" },
  10. { "include": "#onlyif" },
  11. { "include": "#query" },
  12. { "include": "#repeat" },
  13. { "include": "#statement" },
  14. { "include": "#subtest" },
  15. { "include": "#user" }
  16. ],
  17. "repository": {
  18. "comment": {
  19. "patterns": [{
  20. "name": "comment.line.sqllogictest",
  21. "match": "(^|\\G\\s+)#.*$"
  22. }]
  23. },
  24. "halt": {
  25. "match": "^halt",
  26. "name": "keyword.other.sqllogictest"
  27. },
  28. "hash-threshold": {
  29. "match": "^(hash-threshold)\\s+(\\d+)",
  30. "captures": {
  31. "1": { "name": "keyword.other.sqllogictest" },
  32. "2": { "name": "constant.numeric.sqllogictest" }
  33. }
  34. },
  35. "kv-batch-size": {
  36. "match": "^(kv-batch-size)\\s+(\\d+)",
  37. "captures": {
  38. "1": { "name": "keyword.other.sqllogictest" },
  39. "2": { "name": "constant.numeric.sqllogictest" }
  40. }
  41. },
  42. "mode": {
  43. "match": "^(mode)\\s+(cockroach|standard)",
  44. "captures": {
  45. "1": { "name": "keyword.other.sqllogictest" },
  46. "2": { "name": "keyword.other.sqllogictest" }
  47. }
  48. },
  49. "onlyif": {
  50. "begin": "^(skipif|onlyif)\\s+(cockroachdb|mysql|mssql|postgresql|sqlite)",
  51. "end": "$",
  52. "captures": {
  53. "1": { "name": "keyword.other.sqllogictest" },
  54. "2": { "name": "keyword.other.sqllogictest" }
  55. },
  56. "patterns": [{ "include": "#comment" }]
  57. },
  58. "query": {
  59. "begin": "^(query)\\s+(?:(error)\\s+(.*)|([A-Z]+)(?:\\s+(\\S+))?(?:\\s+(\\S+))?.*)$",
  60. "end": "^----$|^$",
  61. "beginCaptures": {
  62. "1": { "name": "keyword.other.sqllogictest" },
  63. "2": { "name": "keyword.other.sqllogictest" },
  64. "3": { "name": "string.unquoted.sqllogictest" },
  65. "4": { "name": "constant.other.sqllogictest" },
  66. "5": {
  67. "patterns": [
  68. { "include": "#query-options-partialsort" },
  69. { "include": "#query-options-standard" }
  70. ]
  71. },
  72. "6": { "name": "variable.other.sqllogictest" }
  73. },
  74. "endCaptures": {
  75. "0": { "name": "keyword.operator.sqllogictest" }
  76. },
  77. "patterns": [{ "include": "source.mzsql" }]
  78. },
  79. "query-options-standard": {
  80. "match": "(colnames|nosort|rowsort|valuesort|retry)",
  81. "name": "keyword.operator.sqllogictest"
  82. },
  83. "query-options-partialsort": {
  84. "match": "(partialsort)\\(([^)]+)\\)",
  85. "captures": {
  86. "1": { "name": "keyword.operator.sqllogictest" },
  87. "2": {
  88. "patterns": [{
  89. "match": "\\d+",
  90. "name": "constant.numeric.sqllogictest"
  91. }]
  92. }
  93. }
  94. },
  95. "repeat": {
  96. "match": "^(repeat)\\s+(\\d+)",
  97. "captures": {
  98. "1": { "name": "keyword.other.sqllogictest" },
  99. "2": { "name": "constant.numeric.sqllogictest" }
  100. }
  101. },
  102. "statement": {
  103. "begin": "(?i:^(statement)\\s+(?:(ok).*|(error)(.*)|(count)\\s+(\\d+).*))$",
  104. "end": "^$",
  105. "beginCaptures": {
  106. "1": { "name": "keyword.other.sqllogictest" },
  107. "2": { "name": "keyword.other.sqllogictest" },
  108. "3": { "name": "keyword.other.sqllogictest" },
  109. "4": { "name": "string.unquoted.sqllogictest" },
  110. "5": { "name": "keyword.other.sqllogictest" },
  111. "6": { "name": "constant.numeric.sqllogictest" }
  112. },
  113. "patterns": [{ "include": "source.mzsql" }]
  114. },
  115. "subtest": {
  116. "match": "^(subtest)\\s+(\\S+)",
  117. "captures": {
  118. "1": { "name": "keyword.other.sqllogictest" },
  119. "2": { "name": "string.unquoted.sqllogictest" }
  120. }
  121. },
  122. "user": {
  123. "match": "^(user)\\s+(\\S+)",
  124. "captures": {
  125. "1": { "name": "keyword.other.sqllogictest" },
  126. "2": { "name": "string.unquoted.sqllogictest" }
  127. }
  128. }
  129. },
  130. "scopeName": "source.sqllogictest"
  131. }