QSP.tmLanguage.json 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. {
  2. "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  3. "name": "QSP",
  4. "scopeName": "text.qsp.qsrc",
  5. "patterns": [
  6. {
  7. "include": "#begin-end"
  8. },
  9. {
  10. "include": "#comments"
  11. },
  12. {
  13. "include": "#keyword-control"
  14. },
  15. {
  16. "include": "#keyword-operators"
  17. },
  18. {
  19. "include": "#marks"
  20. },
  21. {
  22. "include": "#strings"
  23. },
  24. {
  25. "include": "#support-objects"
  26. },
  27. {
  28. "folds": [
  29. {
  30. "type": "comment"
  31. },
  32. {
  33. "type": "if_statement",
  34. "start": {
  35. "type": [
  36. "elif_clause",
  37. "else_clause"
  38. ]
  39. },
  40. "end": "end"
  41. }
  42. ]
  43. }
  44. ],
  45. "repository": {
  46. "begin-end": {
  47. "patterns": [
  48. {
  49. "name": "constant.character.qsp",
  50. "match": "^-{1,2}\\S.*?\\S-{1,2}$"
  51. },
  52. {
  53. "name": "constant.character.qsp",
  54. "match": "^(#)\\s?.+$"
  55. },
  56. {
  57. "name": "constant.character.qsp",
  58. "match": "\\b\\d+\\b"
  59. }
  60. ]
  61. },
  62. "comments": {
  63. "comment": "singe and multiline comments starting with !",
  64. "patterns": [
  65. {
  66. "comment": "comments without possible multiline chars",
  67. "match": "(?:^|\\s?[&])\\s*((!!?)[^{'\"]*?$\\n?)",
  68. "captures": {
  69. "1": {
  70. "name": "comment.line.qsp"
  71. },
  72. "2": {
  73. "name": "punctuation.definition.comment.qsp"
  74. }
  75. }
  76. },
  77. {
  78. "comment": "comments with multiline chars",
  79. "begin": "(?:^|\\s?[&])\\s*(!!?)",
  80. "beginCaptures": {
  81. "0": {
  82. "name": "comment.block.qsp"
  83. },
  84. "1": {
  85. "name": "punctuation.definition.comment.qsp"
  86. }
  87. },
  88. "patterns": [
  89. {
  90. "name": "comment.block.qsp",
  91. "match": "\\G",
  92. "include": "#comment-block"
  93. }
  94. ]
  95. }
  96. ]
  97. },
  98. "comment-block": {
  99. "patterns": [
  100. {
  101. "match": "(\\s*[^{'\"]*)(?=$)",
  102. "captures": {
  103. "1": {
  104. "name": "comment.block.text.qsp"
  105. }
  106. }
  107. },
  108. {
  109. "include": "#comment-block-quote"
  110. },
  111. {
  112. "include": "#comment-block-bracket-curly"
  113. },
  114. {
  115. "match": "(\\s*[^{'\"]*)(?!$)",
  116. "captures": {
  117. "1": {
  118. "name": "comment.block.text.qsp"
  119. }
  120. }
  121. },
  122. {
  123. "comment": "continue parsing after the comment ends",
  124. "begin": "($\\n?)",
  125. "pattern": {
  126. "match": "\\G"
  127. }
  128. }
  129. ]
  130. },
  131. "comment-block-quote": {
  132. "name": "comment.block.quote.qsp",
  133. "begin": "('|\")",
  134. "end": "(\\1)"
  135. },
  136. "comment-block-bracket-curly": {
  137. "name": "comment.block.bracket.curly.qsp",
  138. "begin": "[{]",
  139. "patterns": [
  140. {
  141. "include": "#comment-block-bracket-curly"
  142. },
  143. {
  144. "include": "#comment-block-quote"
  145. }
  146. ],
  147. "end": "([}])"
  148. },
  149. "keyword-control": {
  150. "patterns": [
  151. {
  152. "name": "keyword.control.qsp",
  153. "match": "(\\$)(?=(\\b(?i:(counter|ongload|ongsave|onnewloc|onactsel|onobjsel|onobjadd|onobjdel|usercom|fname|backimage|args|result))\\b))"
  154. },
  155. {
  156. "name": "keyword.control.qsp",
  157. "match": "\\b(?i:(counter|ongload|ongsave|onnewloc|onactsel|onobjsel|onobjadd|onobjdel|usercom|fname|backimage|args|result|nosave|disablescroll|disablesubex|debug|usehtml|(b|f|l)color|fsize))\\b"
  158. }
  159. ]
  160. },
  161. "keyword-operators": {
  162. "patterns": [
  163. {
  164. "name": "keyword.operator.qsp",
  165. "match": "(\\$)(?=(\\b(?i:(dyneval|input|user_text|usrtxt|maintxt|stattxt|func|curloc|selobj|selact|curacts|getobj|mid|(u|l)case|trim|replace|str|loc|strfind))\\b))"
  166. },
  167. {
  168. "name": "keyword.operator.qsp",
  169. "match": "\\b(?i:(dyneval|input|user_text|usrtxt|iif|rgb|isplay|msecscount|desc|maintxt|stattxt|qspver|func|curloc|selobj|no|and|obj|len|mod|selact|curacts|arrsize|arrpos|countobj|getobj|led|mid|(u|l)case|trim|replace|instr|isnum|val|str|loc|or|max|min|r(a)?nd|(arr|str)comp|str(find|pos)))\\b"
  170. }
  171. ]
  172. },
  173. "marks": {
  174. "patterns": [
  175. {
  176. "name": "entity.other.attribute-name.qsp",
  177. "match": "^(:)[^'\"]*$\n?"
  178. },
  179. {
  180. "name": "entity.other.attribute-name.qsp",
  181. "match": "^(\\s+:)[^'\"]*$\n?"
  182. }
  183. ]
  184. },
  185. "strings": {
  186. "name": "string.quoted.single.qsp",
  187. "begin": "(\"|')",
  188. "end": "\\1",
  189. "patterns": [
  190. {
  191. "name": "string.interpolated.qsp",
  192. "begin": "<<",
  193. "end": ">>",
  194. "patterns": [
  195. {
  196. "include": "$self"
  197. }
  198. ]
  199. }
  200. ]
  201. },
  202. "support-objects": {
  203. "patterns": [
  204. {
  205. "name": "support.function.qsp",
  206. "match": "(\\*)(?=(\\b(?i:(pl?|clear|clr|nl))\\b))"
  207. },
  208. {
  209. "name": "support.function.qsp",
  210. "match": "\\b(?i:(nl|pl?|clear|clr|act|exit|killvar|cla|gs|xgt|gt|goto|gosub|\\[|\\]|xgoto|if|else|elseif|end|jump|msg|wait|delact|cmdclear|cmdclr|cls|menu|settimer|dynamic|set|let|play|close|view|copyarr|addobj|delobj|killobj|unselect|unsel|killall|opengame|openqst|addqst|killqst|savegame|refint|showacts|showinput|showobjs|showstat|\\*|&))\\b"
  211. },
  212. {
  213. "name": "support.function.qsp",
  214. "match": "(?i:(,|\\[|\\]|\\(|\\)|\\{|\\}|&|\\/|!|\\*|\\+|=|-|(<|>)=?|=?(<|>)))"
  215. }
  216. ]
  217. }
  218. }
  219. }