tree-sitter-bash.cson 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. name: 'Shell Script'
  2. scopeName: 'source.shell'
  3. type: 'tree-sitter'
  4. parser: 'tree-sitter-bash'
  5. fileTypes: [
  6. 'sh'
  7. 'bash'
  8. 'ksh'
  9. 'zsh'
  10. 'zsh-theme'
  11. 'zshenv'
  12. 'zlogin'
  13. 'zlogout'
  14. 'zprofile'
  15. 'zshrc'
  16. 'bashrc'
  17. 'bash_aliases'
  18. 'bash_profile'
  19. 'bash_login'
  20. 'profile'
  21. 'bash_logout'
  22. 'npmrc'
  23. 'PKGBUILD'
  24. 'install'
  25. 'cygport'
  26. 'bats'
  27. 'ebuild'
  28. ]
  29. injectionRegex: '^(bash|sh|BASH|SH)$'
  30. firstLineRegex: [
  31. # shebang line
  32. '^#!.*\\b(bash|sh)\\r?\\n'
  33. # vim modeline
  34. 'vim\\b.*\\bset\\b.*\\b(filetype|ft|syntax)=(sh|bash)'
  35. ]
  36. folds: [
  37. {
  38. type: 'heredoc_body'
  39. }
  40. {
  41. type: 'if_statement',
  42. start: {type: '"then"'}
  43. end: {type: ['elif_clause', 'else_clause']}
  44. }
  45. {
  46. type: 'elif_clause',
  47. start: {type: '"then"'}
  48. }
  49. {
  50. type: 'if_statement'
  51. start: {type: '"then"'}
  52. end: {index: -1}
  53. }
  54. {
  55. type: 'case_statement'
  56. start: {type: '"in"'}
  57. end: {index: -1}
  58. }
  59. {
  60. type: 'elif_clause'
  61. start: {type: 'then'}
  62. }
  63. {
  64. type: 'else_clause'
  65. start: {index: 0}
  66. }
  67. {
  68. type: 'case_item'
  69. start: {type: ')'}
  70. }
  71. {
  72. type: [
  73. 'array'
  74. 'do_group'
  75. 'subshell'
  76. 'expansion'
  77. 'test_command'
  78. 'compound_statement'
  79. 'process_substitution'
  80. 'command_substitution'
  81. ]
  82. start: {index: 0}
  83. end: {index: -1}
  84. }
  85. ]
  86. comments:
  87. start: '# '
  88. scopes:
  89. 'program': 'source.shell'
  90. 'comment': 'comment.block'
  91. 'string': 'string'
  92. 'raw_string': 'string'
  93. 'ansii_c_string': 'string'
  94. 'heredoc_body': 'string'
  95. 'heredoc_start': 'string'
  96. 'regex': 'string.regexp'
  97. '
  98. "$",
  99. expansion > "${",
  100. expansion > "}"
  101. ': 'punctuation.section.embedded'
  102. 'string > command_substitution': 'embedded.source'
  103. 'function_definition > word': 'entity.name.function'
  104. 'command_name': 'entity.name.function'
  105. 'file_descriptor': 'constant.numeric'
  106. 'command_name > word': [
  107. {match: '^(cd|echo|eval|exit|false|getopts|pushd|popd|return|set|shift|true)$', scopes: 'support.function'}
  108. ]
  109. 'test_operator': 'entity.other.attribute-name'
  110. 'word': [{match: '^-', scopes: 'entity.other.attribute-name'}]
  111. 'special_variable_name': 'variable.other.member'
  112. 'variable_name': 'variable.other.member'
  113. '"if"': 'keyword.control'
  114. '"fi"': 'keyword.control'
  115. '"then"': 'keyword.control'
  116. '"else"': 'keyword.control'
  117. '"elif"': 'keyword.control'
  118. '"for"': 'keyword.control'
  119. '"do"': 'keyword.control'
  120. '"done"': 'keyword.control'
  121. '"case"': 'keyword.control'
  122. '"esac"': 'keyword.control'
  123. '"in"': 'keyword.control'
  124. '"while"': 'keyword.control'
  125. '"until"': 'keyword.control'
  126. '"function"': 'keyword.control'
  127. '"local"': 'keyword.control'
  128. '"declare"': 'keyword.control'
  129. '"export"': 'keyword.control'
  130. '"readonly"': 'keyword.control'
  131. '"typeset"': 'keyword.control'
  132. '"unset"': 'keyword.control'
  133. '"unsetenv"': 'keyword.control'
  134. '"&"': 'keyword.operator'
  135. '"&&"': 'keyword.operator'
  136. '"|"': 'keyword.operator'
  137. '"||"': 'keyword.operator'
  138. '"<"': 'keyword.operator'
  139. '">"': 'keyword.operator'
  140. '">>"': 'keyword.operator'
  141. '"&>"': 'keyword.operator'
  142. '"&>>"': 'keyword.operator'
  143. '"<&"': 'keyword.operator'
  144. '">&"': 'keyword.operator'
  145. '"<<-"': 'keyword.operator'
  146. '"<<<"': 'keyword.operator'