solidity.json 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. {
  2. "fileTypes": [
  3. "sol"
  4. ],
  5. "name": "Solidity",
  6. "patterns": [
  7. {
  8. "include": "#natspec"
  9. },
  10. {
  11. "include": "#comment"
  12. },
  13. {
  14. "include": "#operator"
  15. },
  16. {
  17. "include": "#control"
  18. },
  19. {
  20. "include": "#constant"
  21. },
  22. {
  23. "include": "#number"
  24. },
  25. {
  26. "include": "#string"
  27. },
  28. {
  29. "include": "#type"
  30. },
  31. {
  32. "include": "#global"
  33. },
  34. {
  35. "include": "#declaration"
  36. },
  37. {
  38. "include": "#function-call"
  39. },
  40. {
  41. "include": "#assembly"
  42. },
  43. {
  44. "include": "#punctuation"
  45. }
  46. ],
  47. "repository": {
  48. "natspec": {
  49. "patterns": [
  50. {
  51. "begin": "/\\*\\*",
  52. "end": "\\*/",
  53. "name": "comment.block.documentation.solidity",
  54. "patterns": [
  55. {
  56. "include": "#natspec-tags"
  57. }
  58. ]
  59. },
  60. {
  61. "begin": "///",
  62. "end": "$",
  63. "name": "comment.block.documentation.solidity",
  64. "patterns": [
  65. {
  66. "include": "#natspec-tags"
  67. }
  68. ]
  69. }
  70. ]
  71. },
  72. "natspec-tags": {
  73. "patterns": [
  74. {
  75. "include": "#natspec-tag-title"
  76. },
  77. {
  78. "include": "#natspec-tag-author"
  79. },
  80. {
  81. "include": "#natspec-tag-notice"
  82. },
  83. {
  84. "include": "#natspec-tag-dev"
  85. },
  86. {
  87. "include": "#natspec-tag-param"
  88. },
  89. {
  90. "include": "#natspec-tag-return"
  91. }
  92. ]
  93. },
  94. "natspec-tag-title": {
  95. "match": "(@title)\\b",
  96. "name": "storage.type.title.natspec"
  97. },
  98. "natspec-tag-author": {
  99. "match": "(@author)\\b",
  100. "name": "storage.type.author.natspec"
  101. },
  102. "natspec-tag-notice": {
  103. "match": "(@notice)\\b",
  104. "name": "storage.type.dev.natspec"
  105. },
  106. "natspec-tag-dev": {
  107. "match": "(@dev)\\b",
  108. "name": "storage.type.dev.natspec"
  109. },
  110. "natspec-tag-param": {
  111. "match": "(@param)(\\s+([A-Za-z_]\\w*))?\\b",
  112. "captures": {
  113. "1": {
  114. "name": "storage.type.param.natspec"
  115. },
  116. "3": {
  117. "name": "variable.other.natspec"
  118. }
  119. }
  120. },
  121. "natspec-tag-return": {
  122. "match": "(@return)\\b",
  123. "name": "storage.type.return.natspec"
  124. },
  125. "comment": {
  126. "patterns": [
  127. {
  128. "include": "#comment-line"
  129. },
  130. {
  131. "include": "#comment-block"
  132. }
  133. ]
  134. },
  135. "comment-line": {
  136. "match": "(?<!tp:)//.*?$",
  137. "name": "comment.line.solidity"
  138. },
  139. "comment-block": {
  140. "begin": "/\\*",
  141. "end": "\\*/",
  142. "name": "comment.block.solidity"
  143. },
  144. "operator": {
  145. "patterns": [
  146. {
  147. "include": "#operator-logic"
  148. },
  149. {
  150. "include": "#operator-mapping"
  151. },
  152. {
  153. "include": "#operator-arithmetic"
  154. },
  155. {
  156. "include": "#operator-binary"
  157. },
  158. {
  159. "include": "#operator-assignment"
  160. }
  161. ]
  162. },
  163. "operator-logic": {
  164. "match": "(==|<(?!<)|<=|>(?!>)|>=|\\&\\&|\\|\\||\\:(?!=)|\\?)",
  165. "name": "keyword.operator.logic.solidity"
  166. },
  167. "operator-mapping": {
  168. "match": "(=>)",
  169. "name": "keyword.operator.mapping.solidity"
  170. },
  171. "operator-arithmetic": {
  172. "match": "(\\+|\\-|\\/|\\*)",
  173. "name": "keyword.operator.arithmetic.solidity"
  174. },
  175. "operator-binary": {
  176. "match": "(\\^|\\&|\\||<<|>>)",
  177. "name": "keyword.operator.binary.solidity"
  178. },
  179. "operator-assignment": {
  180. "match": "(\\:?=)",
  181. "name": "keyword.operator.assignment.solidity"
  182. },
  183. "control": {
  184. "patterns": [
  185. {
  186. "include": "#control-flow"
  187. },
  188. {
  189. "include": "#control-using"
  190. },
  191. {
  192. "include": "#control-import"
  193. },
  194. {
  195. "include": "#control-pragma"
  196. },
  197. {
  198. "include": "#control-underscore"
  199. },
  200. {
  201. "include": "#control-other"
  202. }
  203. ]
  204. },
  205. "control-flow": {
  206. "match": "\\b(if|else|for|while|do|break|continue|throw|returns?)\\b",
  207. "name": "keyword.control.flow.solidity"
  208. },
  209. "control-using": {
  210. "match": "\\b(using)\\b",
  211. "name": "keyword.control.using.solidity"
  212. },
  213. "control-import": {
  214. "match": "\\b(import)\\b",
  215. "name": "keyword.control.import.solidity"
  216. },
  217. "control-pragma": {
  218. "match": "\\b(pragma)(?:\\s+([A-Za-z_]\\w+)\\s+([^\\s]+))?\\b",
  219. "captures": {
  220. "1": {
  221. "name": "keyword.control.pragma.solidity"
  222. },
  223. "2": {
  224. "name": "entity.name.tag.pragma.solidity"
  225. },
  226. "3": {
  227. "name": "constant.other.pragma.solidity"
  228. }
  229. }
  230. },
  231. "control-underscore": {
  232. "match": "\\b(_)\\b",
  233. "name": "constant.other.underscore.solidity"
  234. },
  235. "control-other": {
  236. "match": "\\b(new|delete|emit)\\b",
  237. "name": "keyword.control.solidity"
  238. },
  239. "constant": {
  240. "patterns": [
  241. {
  242. "include": "#constant-boolean"
  243. },
  244. {
  245. "include": "#constant-time"
  246. },
  247. {
  248. "include": "#constant-currency"
  249. }
  250. ]
  251. },
  252. "constant-boolean": {
  253. "match": "\\b(true|false)\\b",
  254. "name": "constant.language.boolean.solidity"
  255. },
  256. "constant-time": {
  257. "match": "\\b(seconds|minutes|hours|days|weeks|years)\\b",
  258. "name": "constant.language.time.solidity"
  259. },
  260. "constant-currency": {
  261. "match": "\\b(ether|wei)\\b",
  262. "name": "constant.language.currency.solidity"
  263. },
  264. "number": {
  265. "patterns": [
  266. {
  267. "include": "#number-decimal"
  268. },
  269. {
  270. "include": "#number-hex"
  271. }
  272. ]
  273. },
  274. "number-decimal": {
  275. "match": "\\b(\\d+(\\.\\d+)?)\\b",
  276. "name": "constant.numeric.decimal.solidity"
  277. },
  278. "number-hex": {
  279. "match": "\\b(0[xX][a-fA-F0-9]+)\\b",
  280. "name": "constant.numeric.hexadecimal.solidity"
  281. },
  282. "string": {
  283. "patterns": [
  284. {
  285. "match": "\\\".*?\\\"",
  286. "name": "string.quoted.double.solidity"
  287. },
  288. {
  289. "match": "\\'.*?\\'",
  290. "name": "string.quoted.single.solidity"
  291. }
  292. ]
  293. },
  294. "type": {
  295. "patterns": [
  296. {
  297. "include": "#type-primitive"
  298. }
  299. ]
  300. },
  301. "type-primitive": {
  302. "match": "\\b(address|string\\d*|bytes\\d*|int\\d*|uint\\d*|bool|hash\\d*)\\b",
  303. "name": "support.type.primitive.solidity"
  304. },
  305. "global": {
  306. "patterns": [
  307. {
  308. "include": "#global-variables"
  309. },
  310. {
  311. "include": "#global-functions"
  312. }
  313. ]
  314. },
  315. "global-variables": {
  316. "patterns": [
  317. {
  318. "match": "\\b(msg|block|tx|now)\\b",
  319. "name": "variable.language.transaction.solidity"
  320. },
  321. {
  322. "match": "\\b(this)\\b",
  323. "name": "variable.language.this.solidity"
  324. },
  325. {
  326. "match": "\\b(super)\\b",
  327. "name": "variable.language.super.solidity"
  328. }
  329. ]
  330. },
  331. "global-functions": {
  332. "patterns": [
  333. {
  334. "match": "\\b(require|assert|revert)\\b",
  335. "name": "keyword.control.exceptions.solidity"
  336. },
  337. {
  338. "match": "\\b(selfdestruct|suicide)\\b",
  339. "name": "keyword.control.contract.solidity"
  340. },
  341. {
  342. "match": "\\b(addmod|mulmod|keccak256|sha256|sha3|ripemd160|ecrecover)\\b",
  343. "name": "support.function.math.solidity"
  344. },
  345. {
  346. "match": "\\b(blockhash|gasleft)\\b",
  347. "name": "variable.language.transaction.solidity"
  348. }
  349. ]
  350. },
  351. "declaration": {
  352. "patterns": [
  353. {
  354. "include": "#declaration-contract"
  355. },
  356. {
  357. "include": "#declaration-interface"
  358. },
  359. {
  360. "include": "#declaration-library"
  361. },
  362. {
  363. "include": "#declaration-struct"
  364. },
  365. {
  366. "include": "#declaration-event"
  367. },
  368. {
  369. "include": "#declaration-enum"
  370. },
  371. {
  372. "include": "#declaration-function"
  373. },
  374. {
  375. "include": "#declaration-constructor"
  376. },
  377. {
  378. "include": "#declaration-modifier"
  379. },
  380. {
  381. "include": "#declaration-mapping"
  382. }
  383. ]
  384. },
  385. "declaration-contract": {
  386. "patterns": [
  387. {
  388. "match": "\\b(contract)(\\s+([A-Za-z_]\\w*))?\\b",
  389. "captures": {
  390. "1": {
  391. "name": "storage.type.contract.solidity"
  392. },
  393. "3": {
  394. "name": "entity.name.type.contract.solidity"
  395. }
  396. }
  397. },
  398. {
  399. "match": "\\b(is)\\b",
  400. "name": "storage.modifier.is.solidity"
  401. }
  402. ]
  403. },
  404. "declaration-interface": {
  405. "match": "\\b(interface)(\\s+([A-Za-z_]\\w*))?\\b",
  406. "captures": {
  407. "1": {
  408. "name": "storage.type.interface.solidity"
  409. },
  410. "3": {
  411. "name": "entity.name.type.interface.solidity"
  412. }
  413. }
  414. },
  415. "declaration-library": {
  416. "match": "\\b(library)(\\s+([A-Za-z_]\\w*))?\\b",
  417. "captures": {
  418. "1": {
  419. "name": "storage.type.library.solidity"
  420. },
  421. "3": {
  422. "name": "entity.name.type.library.solidity"
  423. }
  424. }
  425. },
  426. "declaration-struct": {
  427. "match": "\\b(struct)(\\s+([A-Za-z_]\\w*))?\\b",
  428. "captures": {
  429. "1": {
  430. "name": "storage.type.struct.solidity"
  431. },
  432. "3": {
  433. "name": "entity.name.type.struct.solidity"
  434. }
  435. }
  436. },
  437. "declaration-event": {
  438. "match": "\\b(event)(\\s+([A-Za-z_]\\w*))?\\b",
  439. "captures": {
  440. "1": {
  441. "name": "storage.type.event.solidity"
  442. },
  443. "3": {
  444. "name": "entity.name.type.event.solidity"
  445. }
  446. }
  447. },
  448. "declaration-constructor": {
  449. "match": "\\b(constructor)\\b",
  450. "captures": {
  451. "1": {
  452. "name": "storage.type.constructor.solidity"
  453. }
  454. }
  455. },
  456. "declaration-enum": {
  457. "match": "\\b(enum)(\\s+([A-Za-z_]\\w*))?\\b",
  458. "captures": {
  459. "1": {
  460. "name": "storage.type.enum.solidity"
  461. },
  462. "3": {
  463. "name": "entity.name.type.enum.solidity"
  464. }
  465. }
  466. },
  467. "declaration-function": {
  468. "patterns": [
  469. {
  470. "match": "\\b(function)\\s+([A-Za-z_]\\w*)\\b",
  471. "captures": {
  472. "1": {
  473. "name": "storage.type.function.solidity"
  474. },
  475. "2": {
  476. "name": "entity.name.function.solidity"
  477. }
  478. }
  479. },
  480. {
  481. "match": "\\b(private|public|internal|external|constant|pure|view|payable|nonpayable|inherited|indexed|storage|memory|virtual|override)\\b",
  482. "name": "storage.type.mofifier.solidity"
  483. }
  484. ]
  485. },
  486. "declaration-modifier": {
  487. "match": "\\b(modifier)(\\s+([A-Za-z_]\\w*))?\\b",
  488. "captures": {
  489. "1": {
  490. "name": "storage.type.modifier.solidity"
  491. },
  492. "3": {
  493. "name": "entity.name.function.solidity"
  494. }
  495. }
  496. },
  497. "declaration-mapping": {
  498. "match": "\\b(mapping)\\b",
  499. "name": "storage.type.mapping.solidity"
  500. },
  501. "function-call": {
  502. "match": "\\b([A-Za-z_]\\w*)\\s*\\(",
  503. "captures": {
  504. "1": {
  505. "name": "entity.name.function.solidity"
  506. }
  507. }
  508. },
  509. "assembly": {
  510. "patterns": [
  511. {
  512. "match": "\\b(assembly)\\b",
  513. "name": "keyword.control.assembly.solidity"
  514. },
  515. {
  516. "match": "\\b(let)\\b",
  517. "name": "storage.type.assembly.solidity"
  518. }
  519. ]
  520. },
  521. "punctuation": {
  522. "patterns": [
  523. {
  524. "match": ";",
  525. "name": "punctuation.terminator.statement.solidity"
  526. },
  527. {
  528. "match": "\\.",
  529. "name": "punctuation.accessor.solidity"
  530. },
  531. {
  532. "match": ",",
  533. "name": "punctuation.separator.solidity"
  534. }
  535. ]
  536. }
  537. },
  538. "scopeName": "source.solidity",
  539. "uuid": "123"
  540. }