elvish.tmLanguage.json 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {
  2. "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  3. "name": "Elvish",
  4. "scopeName": "source.elvish",
  5. "fileTypes": [
  6. "elv"
  7. ],
  8. "patterns": [
  9. {
  10. "name": "string.quoted.double.elvish",
  11. "begin": "\"",
  12. "end": "\"",
  13. "patterns": [
  14. {
  15. "name": "constant.character.escape.elvish",
  16. "match": "\\\\."
  17. }
  18. ]
  19. },
  20. {
  21. "name": "string.quoted.single.elvish",
  22. "begin": "'",
  23. "end": "'"
  24. },
  25. {
  26. "name": "comment.line.number-sign.elvish",
  27. "begin": "#",
  28. "end": "$"
  29. },
  30. {
  31. "name": "variable.other.elvish",
  32. "match": "\\$[\\w\\d_:~-]+"
  33. },
  34. {
  35. "match": "(?<=\\G|^|\\{ |\\{\t|\\(|\\||\\;)\\s*(var|set|tmp|del)((\\s+[\\w\\d_:~-]+)+)",
  36. "captures": {
  37. "1": {
  38. "name": "keyword.other.elvish"
  39. },
  40. "2": {
  41. "name": "variable.other.elvish"
  42. }
  43. }
  44. },
  45. {
  46. "match": "(?<=\\G|^|\\{ |\\{\t|\\(|\\||\\;)\\s*(for)\\s+([\\w\\d_:~-]+)",
  47. "captures": {
  48. "1": {
  49. "name": "keyword.control.elvish"
  50. },
  51. "2": {
  52. "name": "variable.other.elvish"
  53. }
  54. }
  55. },
  56. {
  57. "match": "(?<=})\\s+(catch|except)\\s+([\\w\\d_:~-]+)",
  58. "captures": {
  59. "1": {
  60. "name": "keyword.control.elvish"
  61. },
  62. "2": {
  63. "name": "variable.other.elvish"
  64. }
  65. }
  66. },
  67. {
  68. "match": "(?<=\\G|^|\\{ |\\{\t|\\(|\\||\\;)\\s*(nop|!=|!=s|%|\\*|\\+|-gc|-ifaddrs|-log|-override-wcwidth|-stack|-|/|<|<=|<=s|<s|==|==s|>|>=|>=s|>s|all|assoc|base|bool|break|call|cd|compare|constantly|continue|count|defer|deprecate|dissoc|drop|each|eawk|echo|eq|eval|exact-num|exec|exit|external|fail|fg|float64|from-json|from-lines|from-terminated|get-env|has-env|has-external|has-key|has-value|is|keys|kind-of|make-map|multi-error|nop|not-eq|not|ns|num|one|only-bytes|only-values|order|peach|pprint|print|printf|put|rand|randint|range|read-line|read-upto|repeat|repr|resolve|return|run-parallel|search-external|set-env|show|sleep|slurp|src|styled|styled-segment|take|tilde-abbr|time|to-json|to-lines|to-string|to-terminated|unset-env|use-mod|wcswidth)(?=[\\s)}<>;|&])",
  69. "captures": {
  70. "1": {
  71. "name": "support.function.elvish"
  72. }
  73. }
  74. },
  75. {
  76. "match": "(?<=\\G|^|\\{ |\\{\t|\\(|\\||\\;)\\s*(and|or|coalesce)(?=[\\s)}<>;|&])",
  77. "captures": {
  78. "1": {
  79. "name": "keyword.operator.elvish"
  80. }
  81. }
  82. },
  83. {
  84. "match": "(?<=\\G|^|\\{ |\\{\t|\\(|\\||\\;)\\s*(use|var|set|tmp|del|pragma|fn)(?=[\\s)}<>;|&])",
  85. "captures": {
  86. "1": {
  87. "name": "keyword.other.elvish"
  88. }
  89. }
  90. },
  91. {
  92. "match": "(?<=\\G|^|\\{ |\\{\t|\\(|\\||\\;)\\s*(while|for|try|if)(?=[\\s)}<>;|&])",
  93. "captures": {
  94. "1": {
  95. "name": "keyword.control.elvish"
  96. }
  97. }
  98. },
  99. {
  100. "match": "(?<=})\\s+(elif|else|catch|except|finally)(?=[\\s)}<>;|&])",
  101. "captures": {
  102. "1": {
  103. "name": "keyword.control.elvish"
  104. }
  105. }
  106. },
  107. {
  108. "name": "keyword.operator.elvish",
  109. "match": "[*?|&;<>()\\[\\]{}]"
  110. }
  111. ]
  112. }