march-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/bin/march.mjs +13 -0
  2. package/package.json +36 -0
  3. package/src/agent/command-exec-tool.mjs +91 -0
  4. package/src/agent/context-stats-tool.mjs +57 -0
  5. package/src/agent/editing/diff-apply.mjs +28 -0
  6. package/src/agent/editing/diff-format.mjs +57 -0
  7. package/src/agent/file-edit-tool.mjs +276 -0
  8. package/src/agent/find-tool.mjs +112 -0
  9. package/src/agent/model-payload-dumper.mjs +201 -0
  10. package/src/agent/pi-session/pi-session-sidecar-failure.mjs +10 -0
  11. package/src/agent/provider/payload-messages.mjs +138 -0
  12. package/src/agent/read-file-tool.mjs +112 -0
  13. package/src/agent/runner/fast-model.mjs +36 -0
  14. package/src/agent/runner/runner-cleanup.mjs +12 -0
  15. package/src/agent/runner/runner-init.mjs +15 -0
  16. package/src/agent/runner/runner-session-state.mjs +40 -0
  17. package/src/agent/runner.mjs +266 -0
  18. package/src/agent/runtime/runner-runtime-host.mjs +73 -0
  19. package/src/agent/runtime/runtime-factory.mjs +42 -0
  20. package/src/agent/runtime/runtime-host.mjs +34 -0
  21. package/src/agent/session/session-auto-name.mjs +41 -0
  22. package/src/agent/session/session-binding.mjs +12 -0
  23. package/src/agent/session/session-options.mjs +46 -0
  24. package/src/agent/tool-names.mjs +1 -0
  25. package/src/agent/tool-result.mjs +3 -0
  26. package/src/agent/tools.mjs +54 -0
  27. package/src/agent/turn/turn-events.mjs +64 -0
  28. package/src/agent/turn/turn-runner.mjs +103 -0
  29. package/src/auth/login-command.mjs +90 -0
  30. package/src/auth/storage.mjs +33 -0
  31. package/src/cli/args.mjs +71 -0
  32. package/src/cli/commands/copy-command.mjs +73 -0
  33. package/src/cli/commands/export-command.mjs +206 -0
  34. package/src/cli/commands/extensions-command.mjs +53 -0
  35. package/src/cli/commands/help-command.mjs +7 -0
  36. package/src/cli/commands/model-command.mjs +110 -0
  37. package/src/cli/commands/paste-image-command.mjs +43 -0
  38. package/src/cli/commands/provider-command.mjs +55 -0
  39. package/src/cli/commands/status-command.mjs +157 -0
  40. package/src/cli/commands/thinking-command.mjs +80 -0
  41. package/src/cli/fallback-ui.mjs +156 -0
  42. package/src/cli/input/attachment-tokens.mjs +20 -0
  43. package/src/cli/input/autocomplete.mjs +106 -0
  44. package/src/cli/input/external-editor.mjs +39 -0
  45. package/src/cli/input/history-store.mjs +35 -0
  46. package/src/cli/input/image-clipboard.mjs +55 -0
  47. package/src/cli/input/keybinding-dispatch.mjs +76 -0
  48. package/src/cli/input/keybindings.mjs +96 -0
  49. package/src/cli/input/mode-state.mjs +43 -0
  50. package/src/cli/input/prompt-templates.mjs +84 -0
  51. package/src/cli/input/select-with-keyboard.mjs +67 -0
  52. package/src/cli/permissions.mjs +103 -0
  53. package/src/cli/repl-commands.mjs +86 -0
  54. package/src/cli/repl-loop.mjs +157 -0
  55. package/src/cli/selector-list.mjs +21 -0
  56. package/src/cli/session/pi-session-switch-command.mjs +41 -0
  57. package/src/cli/session/session-command.mjs +23 -0
  58. package/src/cli/session/session-list-command.mjs +68 -0
  59. package/src/cli/session/session-name-command.mjs +26 -0
  60. package/src/cli/session/session-source-command.mjs +89 -0
  61. package/src/cli/session/session-switch-command.mjs +1 -0
  62. package/src/cli/shell/shell-command.mjs +55 -0
  63. package/src/cli/shell/shell-drawer-controls.mjs +33 -0
  64. package/src/cli/shell/shell-drawer.mjs +192 -0
  65. package/src/cli/shell/shell-split-layout.mjs +70 -0
  66. package/src/cli/slash-commands.mjs +176 -0
  67. package/src/cli/startup/startup-banner.mjs +17 -0
  68. package/src/cli/startup/startup-session.mjs +51 -0
  69. package/src/cli/status-line-updater.mjs +74 -0
  70. package/src/cli/tool-output.mjs +9 -0
  71. package/src/cli/tui/editor/external-editor-runner.mjs +24 -0
  72. package/src/cli/tui/input/mouse-selection-controller.mjs +89 -0
  73. package/src/cli/tui/input/mouse-tracking.mjs +20 -0
  74. package/src/cli/tui/layout/main-pane-layout.mjs +38 -0
  75. package/src/cli/tui/layout/safe-render-boundary.mjs +46 -0
  76. package/src/cli/tui/markdown-renderer.mjs +279 -0
  77. package/src/cli/tui/output/scroll-state.mjs +79 -0
  78. package/src/cli/tui/output/tool-card-renderer.mjs +59 -0
  79. package/src/cli/tui/output-buffer.mjs +297 -0
  80. package/src/cli/tui/permission-request-ui.mjs +18 -0
  81. package/src/cli/tui/recall-rendering.mjs +25 -0
  82. package/src/cli/tui/select/editor-select-list.mjs +111 -0
  83. package/src/cli/tui/selection-screen.mjs +212 -0
  84. package/src/cli/tui/status/retry-status.mjs +72 -0
  85. package/src/cli/tui/status/spinner-status.mjs +42 -0
  86. package/src/cli/tui/status/status-bar.mjs +88 -0
  87. package/src/cli/tui/syntax/highlighting.mjs +277 -0
  88. package/src/cli/tui/syntax/languages.mjs +91 -0
  89. package/src/cli/tui/syntax/tree-sitter/bash.highlights.scm +261 -0
  90. package/src/cli/tui/syntax/tree-sitter/c.highlights.scm +341 -0
  91. package/src/cli/tui/syntax/tree-sitter/cpp.highlights.scm +268 -0
  92. package/src/cli/tui/syntax/tree-sitter/csharp.highlights.scm +577 -0
  93. package/src/cli/tui/syntax/tree-sitter/css.highlights.scm +109 -0
  94. package/src/cli/tui/syntax/tree-sitter/diff.highlights.scm +49 -0
  95. package/src/cli/tui/syntax/tree-sitter/go.highlights.scm +254 -0
  96. package/src/cli/tui/syntax/tree-sitter/html.highlights.scm +13 -0
  97. package/src/cli/tui/syntax/tree-sitter/java.highlights.scm +330 -0
  98. package/src/cli/tui/syntax/tree-sitter/json.highlights.scm +38 -0
  99. package/src/cli/tui/syntax/tree-sitter/php.highlights.scm +203 -0
  100. package/src/cli/tui/syntax/tree-sitter/python.highlights.scm +137 -0
  101. package/src/cli/tui/syntax/tree-sitter/ruby.highlights.scm +309 -0
  102. package/src/cli/tui/syntax/tree-sitter/rust.highlights.scm +531 -0
  103. package/src/cli/tui/syntax/tree-sitter/toml.highlights.scm +39 -0
  104. package/src/cli/tui/syntax/tree-sitter/tree-sitter-bash.wasm +0 -0
  105. package/src/cli/tui/syntax/tree-sitter/tree-sitter-c-sharp.wasm +0 -0
  106. package/src/cli/tui/syntax/tree-sitter/tree-sitter-c.wasm +0 -0
  107. package/src/cli/tui/syntax/tree-sitter/tree-sitter-cpp.wasm +0 -0
  108. package/src/cli/tui/syntax/tree-sitter/tree-sitter-css.wasm +0 -0
  109. package/src/cli/tui/syntax/tree-sitter/tree-sitter-diff.wasm +0 -0
  110. package/src/cli/tui/syntax/tree-sitter/tree-sitter-go.wasm +0 -0
  111. package/src/cli/tui/syntax/tree-sitter/tree-sitter-html.wasm +0 -0
  112. package/src/cli/tui/syntax/tree-sitter/tree-sitter-java.wasm +0 -0
  113. package/src/cli/tui/syntax/tree-sitter/tree-sitter-json.wasm +0 -0
  114. package/src/cli/tui/syntax/tree-sitter/tree-sitter-php.wasm +0 -0
  115. package/src/cli/tui/syntax/tree-sitter/tree-sitter-python.wasm +0 -0
  116. package/src/cli/tui/syntax/tree-sitter/tree-sitter-ruby.wasm +0 -0
  117. package/src/cli/tui/syntax/tree-sitter/tree-sitter-rust.wasm +0 -0
  118. package/src/cli/tui/syntax/tree-sitter/tree-sitter-toml.wasm +0 -0
  119. package/src/cli/tui/syntax/tree-sitter/tree-sitter-tsx.wasm +0 -0
  120. package/src/cli/tui/syntax/tree-sitter/tree-sitter-typescript.wasm +0 -0
  121. package/src/cli/tui/syntax/tree-sitter/tree-sitter-yaml.wasm +0 -0
  122. package/src/cli/tui/syntax/tree-sitter/tsx.highlights.scm +35 -0
  123. package/src/cli/tui/syntax/tree-sitter/typescript.highlights.scm +35 -0
  124. package/src/cli/tui/syntax/tree-sitter/yaml.highlights.scm +99 -0
  125. package/src/cli/tui/tool-rendering.mjs +194 -0
  126. package/src/cli/tui/tui-diff-rendering.mjs +157 -0
  127. package/src/cli/tui/tui-handlers.mjs +110 -0
  128. package/src/cli/tui/tui-input-controller.mjs +61 -0
  129. package/src/cli/tui/ui-theme.mjs +148 -0
  130. package/src/cli/ui.mjs +299 -0
  131. package/src/config/config-json.mjs +73 -0
  132. package/src/config/dotenv.mjs +20 -0
  133. package/src/config/features.mjs +75 -0
  134. package/src/config/loader.mjs +109 -0
  135. package/src/config/settings-command.mjs +97 -0
  136. package/src/context/diagnostics.mjs +70 -0
  137. package/src/context/engine.mjs +148 -0
  138. package/src/context/injections.mjs +26 -0
  139. package/src/context/project-context.mjs +20 -0
  140. package/src/context/session-status.mjs +15 -0
  141. package/src/context/shell-layers.mjs +23 -0
  142. package/src/context/system-core/base.md +60 -0
  143. package/src/context/system-core/prompts/deepseek-v4-pro.md +3 -0
  144. package/src/context/system-core/prompts/default.md +3 -0
  145. package/src/context/system-core.mjs +35 -0
  146. package/src/debug/model-context-dumper.mjs +52 -0
  147. package/src/extensions/discovery.mjs +40 -0
  148. package/src/extensions/lifecycle-adapter.mjs +210 -0
  149. package/src/extensions/lifecycle-manifest.mjs +69 -0
  150. package/src/image-gen/index.mjs +7 -0
  151. package/src/image-gen/provider.mjs +231 -0
  152. package/src/image-gen/tool.mjs +84 -0
  153. package/src/lsp/client.mjs +204 -0
  154. package/src/lsp/diagnostic-store.mjs +39 -0
  155. package/src/lsp/servers.mjs +212 -0
  156. package/src/lsp/service.mjs +65 -0
  157. package/src/main.mjs +294 -0
  158. package/src/mcp/client.mjs +195 -0
  159. package/src/mcp/config.mjs +130 -0
  160. package/src/mcp/index.mjs +48 -0
  161. package/src/mcp/tools.mjs +98 -0
  162. package/src/memory/database.mjs +219 -0
  163. package/src/memory/glossary.mjs +124 -0
  164. package/src/memory/graph/graph-cascades.mjs +109 -0
  165. package/src/memory/graph/graph-diagnostics.mjs +73 -0
  166. package/src/memory/graph/graph-path-removal.mjs +50 -0
  167. package/src/memory/graph/graph-path-utils.mjs +17 -0
  168. package/src/memory/graph/graph-primitives.mjs +103 -0
  169. package/src/memory/graph/graph-read.mjs +159 -0
  170. package/src/memory/graph.mjs +282 -0
  171. package/src/memory/markdown/markdown-delete.mjs +23 -0
  172. package/src/memory/markdown/markdown-format.mjs +128 -0
  173. package/src/memory/markdown/markdown-recall.mjs +28 -0
  174. package/src/memory/markdown/ripgrep.mjs +16 -0
  175. package/src/memory/markdown/sqlite-index.mjs +87 -0
  176. package/src/memory/markdown-store.mjs +286 -0
  177. package/src/memory/markdown-tools.mjs +103 -0
  178. package/src/memory/search.mjs +142 -0
  179. package/src/memory/snapshot.mjs +86 -0
  180. package/src/memory/system-views.mjs +120 -0
  181. package/src/memory/tools.mjs +282 -0
  182. package/src/notification/desktop-notifier.mjs +85 -0
  183. package/src/platform/open-file.mjs +28 -0
  184. package/src/provider/config-command.mjs +129 -0
  185. package/src/provider/presets.mjs +72 -0
  186. package/src/session/attachment-display.mjs +16 -0
  187. package/src/session/attachment-references.mjs +65 -0
  188. package/src/session/attachments.mjs +140 -0
  189. package/src/session/persist.mjs +1 -0
  190. package/src/session/pi-manager.mjs +34 -0
  191. package/src/session/session-utils.mjs +16 -0
  192. package/src/session/sidecar-sync.mjs +19 -0
  193. package/src/session/sidecar.mjs +68 -0
  194. package/src/session/transcript.mjs +83 -0
  195. package/src/session/tree.mjs +42 -0
  196. package/src/shell/cli-runtime.mjs +11 -0
  197. package/src/shell/hints.mjs +12 -0
  198. package/src/shell/node-pty-adapter.mjs +81 -0
  199. package/src/shell/runtime-state.mjs +126 -0
  200. package/src/shell/runtime.mjs +244 -0
  201. package/src/shell/screen-buffer.mjs +136 -0
  202. package/src/shell/tool-read.mjs +74 -0
  203. package/src/shell/tools.mjs +299 -0
  204. package/src/supergrok/actions/image-generate.mjs +60 -0
  205. package/src/supergrok/actions/search.mjs +78 -0
  206. package/src/supergrok/auth.mjs +36 -0
  207. package/src/supergrok/constants.mjs +18 -0
  208. package/src/supergrok/oauth-provider.mjs +278 -0
  209. package/src/supergrok/provider.mjs +36 -0
  210. package/src/supergrok/response.mjs +76 -0
  211. package/src/supergrok/tool.mjs +61 -0
  212. package/src/text/ansi.mjs +3 -0
  213. package/src/web/config-command.mjs +43 -0
  214. package/src/web/fetch.mjs +78 -0
  215. package/src/web/presets.mjs +16 -0
  216. package/src/web/search.mjs +83 -0
  217. package/src/web/tools.mjs +107 -0
@@ -0,0 +1,261 @@
1
+ [
2
+ "("
3
+ ")"
4
+ "{"
5
+ "}"
6
+ "["
7
+ "]"
8
+ "[["
9
+ "]]"
10
+ "(("
11
+ "))"
12
+ ] @punctuation.bracket
13
+
14
+ [
15
+ ";"
16
+ ";;"
17
+ ";&"
18
+ ";;&"
19
+ "&"
20
+ ] @punctuation.delimiter
21
+
22
+ [
23
+ ">"
24
+ ">>"
25
+ "<"
26
+ "<<"
27
+ "&&"
28
+ "|"
29
+ "|&"
30
+ "||"
31
+ "="
32
+ "+="
33
+ "=~"
34
+ "=="
35
+ "!="
36
+ "&>"
37
+ "&>>"
38
+ "<&"
39
+ ">&"
40
+ ">|"
41
+ "<&-"
42
+ ">&-"
43
+ "<<-"
44
+ "<<<"
45
+ ".."
46
+ "!"
47
+ ] @operator
48
+
49
+ ; Do *not* spell check strings since they typically have some sort of
50
+ ; interpolation in them, or, are typically used for things like filenames, URLs,
51
+ ; flags and file content.
52
+ [
53
+ (string)
54
+ (raw_string)
55
+ (ansi_c_string)
56
+ (heredoc_body)
57
+ ] @string
58
+
59
+ [
60
+ (heredoc_start)
61
+ (heredoc_end)
62
+ ] @label
63
+
64
+ (variable_assignment
65
+ (word) @string)
66
+
67
+ (command
68
+ argument: "$" @string) ; bare dollar
69
+
70
+ (concatenation
71
+ (word) @string)
72
+
73
+ [
74
+ "if"
75
+ "then"
76
+ "else"
77
+ "elif"
78
+ "fi"
79
+ "case"
80
+ "in"
81
+ "esac"
82
+ ] @keyword.conditional
83
+
84
+ [
85
+ "for"
86
+ "do"
87
+ "done"
88
+ "select"
89
+ "until"
90
+ "while"
91
+ ] @keyword.repeat
92
+
93
+ [
94
+ "declare"
95
+ "typeset"
96
+ "readonly"
97
+ "local"
98
+ "unset"
99
+ "unsetenv"
100
+ ] @keyword
101
+
102
+ "export" @keyword.import
103
+
104
+ "function" @keyword.function
105
+
106
+ (special_variable_name) @constant
107
+
108
+ ; trap -l
109
+ ((word) @constant.builtin
110
+ (#any-of? @constant.builtin
111
+ "SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" "SIGBUS" "SIGFPE" "SIGKILL" "SIGUSR1"
112
+ "SIGSEGV" "SIGUSR2" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGSTKFLT" "SIGCHLD" "SIGCONT" "SIGSTOP"
113
+ "SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG" "SIGXCPU" "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH"
114
+ "SIGIO" "SIGPWR" "SIGSYS" "SIGRTMIN" "SIGRTMIN+1" "SIGRTMIN+2" "SIGRTMIN+3" "SIGRTMIN+4"
115
+ "SIGRTMIN+5" "SIGRTMIN+6" "SIGRTMIN+7" "SIGRTMIN+8" "SIGRTMIN+9" "SIGRTMIN+10" "SIGRTMIN+11"
116
+ "SIGRTMIN+12" "SIGRTMIN+13" "SIGRTMIN+14" "SIGRTMIN+15" "SIGRTMAX-14" "SIGRTMAX-13"
117
+ "SIGRTMAX-12" "SIGRTMAX-11" "SIGRTMAX-10" "SIGRTMAX-9" "SIGRTMAX-8" "SIGRTMAX-7" "SIGRTMAX-6"
118
+ "SIGRTMAX-5" "SIGRTMAX-4" "SIGRTMAX-3" "SIGRTMAX-2" "SIGRTMAX-1" "SIGRTMAX"))
119
+
120
+ ((word) @boolean
121
+ (#any-of? @boolean "true" "false"))
122
+
123
+ (comment) @comment @spell
124
+
125
+ (test_operator) @operator
126
+
127
+ (command_substitution
128
+ "$(" @punctuation.special
129
+ ")" @punctuation.special)
130
+
131
+ (process_substitution
132
+ [
133
+ "<("
134
+ ">("
135
+ ] @punctuation.special
136
+ ")" @punctuation.special)
137
+
138
+ (arithmetic_expansion
139
+ [
140
+ "$(("
141
+ "(("
142
+ ] @punctuation.special
143
+ "))" @punctuation.special)
144
+
145
+ (arithmetic_expansion
146
+ "," @punctuation.delimiter)
147
+
148
+ (ternary_expression
149
+ [
150
+ "?"
151
+ ":"
152
+ ] @keyword.conditional.ternary)
153
+
154
+ (binary_expression
155
+ operator: _ @operator)
156
+
157
+ (unary_expression
158
+ operator: _ @operator)
159
+
160
+ (postfix_expression
161
+ operator: _ @operator)
162
+
163
+ (function_definition
164
+ name: (word) @function)
165
+
166
+ (command_name
167
+ (word) @function.call)
168
+
169
+ (command_name
170
+ (word) @function.builtin
171
+ (#any-of? @function.builtin
172
+ "." ":" "alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete"
173
+ "compopt" "continue" "coproc" "dirs" "disown" "echo" "enable" "eval" "exec" "exit" "false" "fc"
174
+ "fg" "getopts" "hash" "help" "history" "jobs" "kill" "let" "logout" "mapfile" "popd" "printf"
175
+ "pushd" "pwd" "read" "readarray" "return" "set" "shift" "shopt" "source" "suspend" "test" "time"
176
+ "times" "trap" "true" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
177
+
178
+ (command
179
+ argument: [
180
+ (word) @variable.parameter
181
+ (concatenation
182
+ (word) @variable.parameter)
183
+ ])
184
+
185
+ (declaration_command
186
+ (word) @variable.parameter)
187
+
188
+ (unset_command
189
+ (word) @variable.parameter)
190
+
191
+ (number) @number
192
+
193
+ ((word) @number
194
+ (#lua-match? @number "^[0-9]+$"))
195
+
196
+ (file_redirect
197
+ (word) @string.special.path)
198
+
199
+ (herestring_redirect
200
+ (word) @string)
201
+
202
+ (file_descriptor) @operator
203
+
204
+ (simple_expansion
205
+ "$" @punctuation.special) @none
206
+
207
+ (expansion
208
+ "${" @punctuation.special
209
+ "}" @punctuation.special) @none
210
+
211
+ (expansion
212
+ operator: _ @punctuation.special)
213
+
214
+ (expansion
215
+ "@"
216
+ .
217
+ operator: _ @character.special)
218
+
219
+ ((expansion
220
+ (subscript
221
+ index: (word) @character.special))
222
+ (#any-of? @character.special "@" "*"))
223
+
224
+ "``" @punctuation.special
225
+
226
+ (variable_name) @variable
227
+
228
+ ((variable_name) @constant
229
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
230
+
231
+ ((variable_name) @variable.builtin
232
+ (#any-of? @variable.builtin
233
+ ; https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Variables.html
234
+ "CDPATH" "HOME" "IFS" "MAIL" "MAILPATH" "OPTARG" "OPTIND" "PATH" "PS1" "PS2"
235
+ ; https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html
236
+ "_" "BASH" "BASHOPTS" "BASHPID" "BASH_ALIASES" "BASH_ARGC" "BASH_ARGV" "BASH_ARGV0" "BASH_CMDS"
237
+ "BASH_COMMAND" "BASH_COMPAT" "BASH_ENV" "BASH_EXECUTION_STRING" "BASH_LINENO"
238
+ "BASH_LOADABLES_PATH" "BASH_REMATCH" "BASH_SOURCE" "BASH_SUBSHELL" "BASH_VERSINFO"
239
+ "BASH_VERSION" "BASH_XTRACEFD" "CHILD_MAX" "COLUMNS" "COMP_CWORD" "COMP_LINE" "COMP_POINT"
240
+ "COMP_TYPE" "COMP_KEY" "COMP_WORDBREAKS" "COMP_WORDS" "COMPREPLY" "COPROC" "DIRSTACK" "EMACS"
241
+ "ENV" "EPOCHREALTIME" "EPOCHSECONDS" "EUID" "EXECIGNORE" "FCEDIT" "FIGNORE" "FUNCNAME"
242
+ "FUNCNEST" "GLOBIGNORE" "GROUPS" "histchars" "HISTCMD" "HISTCONTROL" "HISTFILE" "HISTFILESIZE"
243
+ "HISTIGNORE" "HISTSIZE" "HISTTIMEFORMAT" "HOSTFILE" "HOSTNAME" "HOSTTYPE" "IGNOREEOF" "INPUTRC"
244
+ "INSIDE_EMACS" "LANG" "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES" "LC_NUMERIC" "LC_TIME"
245
+ "LINENO" "LINES" "MACHTYPE" "MAILCHECK" "MAPFILE" "OLDPWD" "OPTERR" "OSTYPE" "PIPESTATUS"
246
+ "POSIXLY_CORRECT" "PPID" "PROMPT_COMMAND" "PROMPT_DIRTRIM" "PS0" "PS3" "PS4" "PWD" "RANDOM"
247
+ "READLINE_ARGUMENT" "READLINE_LINE" "READLINE_MARK" "READLINE_POINT" "REPLY" "SECONDS" "SHELL"
248
+ "SHELLOPTS" "SHLVL" "SRANDOM" "TIMEFORMAT" "TMOUT" "TMPDIR" "UID"))
249
+
250
+ (case_item
251
+ value: (word) @variable.parameter)
252
+
253
+ [
254
+ (regex)
255
+ (extglob_pattern)
256
+ ] @string.regexp
257
+
258
+ ((program
259
+ .
260
+ (comment) @keyword.directive @nospell)
261
+ (#lua-match? @keyword.directive "^#!/"))
@@ -0,0 +1,341 @@
1
+ ; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
2
+ ((identifier) @variable
3
+ (#set! priority 95))
4
+
5
+ (preproc_def
6
+ (preproc_arg) @variable)
7
+
8
+ [
9
+ "default"
10
+ "goto"
11
+ "asm"
12
+ "__asm__"
13
+ ] @keyword
14
+
15
+ [
16
+ "enum"
17
+ "struct"
18
+ "union"
19
+ "typedef"
20
+ ] @keyword.type
21
+
22
+ [
23
+ "sizeof"
24
+ "offsetof"
25
+ ] @keyword.operator
26
+
27
+ (alignof_expression
28
+ .
29
+ _ @keyword.operator)
30
+
31
+ "return" @keyword.return
32
+
33
+ [
34
+ "while"
35
+ "for"
36
+ "do"
37
+ "continue"
38
+ "break"
39
+ ] @keyword.repeat
40
+
41
+ [
42
+ "if"
43
+ "else"
44
+ "case"
45
+ "switch"
46
+ ] @keyword.conditional
47
+
48
+ [
49
+ "#if"
50
+ "#ifdef"
51
+ "#ifndef"
52
+ "#else"
53
+ "#elif"
54
+ "#endif"
55
+ "#elifdef"
56
+ "#elifndef"
57
+ (preproc_directive)
58
+ ] @keyword.directive
59
+
60
+ "#define" @keyword.directive.define
61
+
62
+ "#include" @keyword.import
63
+
64
+ [
65
+ ";"
66
+ ":"
67
+ ","
68
+ "."
69
+ "::"
70
+ ] @punctuation.delimiter
71
+
72
+ "..." @punctuation.special
73
+
74
+ [
75
+ "("
76
+ ")"
77
+ "["
78
+ "]"
79
+ "{"
80
+ "}"
81
+ ] @punctuation.bracket
82
+
83
+ [
84
+ "="
85
+ "-"
86
+ "*"
87
+ "/"
88
+ "+"
89
+ "%"
90
+ "~"
91
+ "|"
92
+ "&"
93
+ "^"
94
+ "<<"
95
+ ">>"
96
+ "->"
97
+ "<"
98
+ "<="
99
+ ">="
100
+ ">"
101
+ "=="
102
+ "!="
103
+ "!"
104
+ "&&"
105
+ "||"
106
+ "-="
107
+ "+="
108
+ "*="
109
+ "/="
110
+ "%="
111
+ "|="
112
+ "&="
113
+ "^="
114
+ ">>="
115
+ "<<="
116
+ "--"
117
+ "++"
118
+ ] @operator
119
+
120
+ ; Make sure the comma operator is given a highlight group after the comma
121
+ ; punctuator so the operator is highlighted properly.
122
+ (comma_expression
123
+ "," @operator)
124
+
125
+ [
126
+ (true)
127
+ (false)
128
+ ] @boolean
129
+
130
+ (conditional_expression
131
+ [
132
+ "?"
133
+ ":"
134
+ ] @keyword.conditional.ternary)
135
+
136
+ (string_literal) @string
137
+
138
+ (system_lib_string) @string
139
+
140
+ (escape_sequence) @string.escape
141
+
142
+ (null) @constant.builtin
143
+
144
+ (number_literal) @number
145
+
146
+ (char_literal) @character
147
+
148
+ (preproc_defined) @function.macro
149
+
150
+ ((field_expression
151
+ (field_identifier) @property) @_parent
152
+ (#not-has-parent? @_parent template_method function_declarator call_expression))
153
+
154
+ (field_designator) @property
155
+
156
+ ((field_identifier) @property
157
+ (#has-ancestor? @property field_declaration)
158
+ (#not-has-ancestor? @property function_declarator))
159
+
160
+ (statement_identifier) @label
161
+
162
+ (declaration
163
+ type: (type_identifier) @_type
164
+ declarator: (identifier) @label
165
+ (#eq? @_type "__label__"))
166
+
167
+ [
168
+ (type_identifier)
169
+ (type_descriptor)
170
+ ] @type
171
+
172
+ (storage_class_specifier) @keyword.modifier
173
+
174
+ [
175
+ (type_qualifier)
176
+ (gnu_asm_qualifier)
177
+ "__extension__"
178
+ ] @keyword.modifier
179
+
180
+ (linkage_specification
181
+ "extern" @keyword.modifier)
182
+
183
+ (type_definition
184
+ declarator: (type_identifier) @type.definition)
185
+
186
+ (primitive_type) @type.builtin
187
+
188
+ (sized_type_specifier
189
+ _ @type.builtin
190
+ type: _?)
191
+
192
+ ((identifier) @constant
193
+ (#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
194
+
195
+ (preproc_def
196
+ (preproc_arg) @constant
197
+ (#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
198
+
199
+ (enumerator
200
+ name: (identifier) @constant)
201
+
202
+ (case_statement
203
+ value: (identifier) @constant)
204
+
205
+ ((identifier) @constant.builtin
206
+ ; format-ignore
207
+ (#any-of? @constant.builtin
208
+ "stderr" "stdin" "stdout"
209
+ "__FILE__" "__LINE__" "__DATE__" "__TIME__"
210
+ "__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__"
211
+ "__cplusplus" "__OBJC__" "__ASSEMBLER__"
212
+ "__BASE_FILE__" "__FILE_NAME__" "__INCLUDE_LEVEL__"
213
+ "__TIMESTAMP__" "__clang__" "__clang_major__"
214
+ "__clang_minor__" "__clang_patchlevel__"
215
+ "__clang_version__" "__clang_literal_encoding__"
216
+ "__clang_wide_literal_encoding__"
217
+ "__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
218
+ "__VA_ARGS__" "__VA_OPT__"))
219
+
220
+ (preproc_def
221
+ (preproc_arg) @constant.builtin
222
+ ; format-ignore
223
+ (#any-of? @constant.builtin
224
+ "stderr" "stdin" "stdout"
225
+ "__FILE__" "__LINE__" "__DATE__" "__TIME__"
226
+ "__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__"
227
+ "__cplusplus" "__OBJC__" "__ASSEMBLER__"
228
+ "__BASE_FILE__" "__FILE_NAME__" "__INCLUDE_LEVEL__"
229
+ "__TIMESTAMP__" "__clang__" "__clang_major__"
230
+ "__clang_minor__" "__clang_patchlevel__"
231
+ "__clang_version__" "__clang_literal_encoding__"
232
+ "__clang_wide_literal_encoding__"
233
+ "__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
234
+ "__VA_ARGS__" "__VA_OPT__"))
235
+
236
+ (attribute_specifier
237
+ (argument_list
238
+ (identifier) @variable.builtin))
239
+
240
+ (attribute_specifier
241
+ (argument_list
242
+ (call_expression
243
+ function: (identifier) @variable.builtin)))
244
+
245
+ ((call_expression
246
+ function: (identifier) @function.builtin)
247
+ (#lua-match? @function.builtin "^__builtin_"))
248
+
249
+ ((call_expression
250
+ function: (identifier) @function.builtin)
251
+ (#has-ancestor? @function.builtin attribute_specifier))
252
+
253
+ ; Preproc def / undef
254
+ (preproc_def
255
+ name: (_) @constant.macro)
256
+
257
+ (preproc_call
258
+ directive: (preproc_directive) @_u
259
+ argument: (_) @constant.macro
260
+ (#eq? @_u "#undef"))
261
+
262
+ (preproc_ifdef
263
+ name: (identifier) @constant.macro)
264
+
265
+ (preproc_elifdef
266
+ name: (identifier) @constant.macro)
267
+
268
+ (preproc_defined
269
+ (identifier) @constant.macro)
270
+
271
+ (call_expression
272
+ function: (identifier) @function.call)
273
+
274
+ (call_expression
275
+ function: (field_expression
276
+ field: (field_identifier) @function.call))
277
+
278
+ (function_declarator
279
+ declarator: (identifier) @function)
280
+
281
+ (function_declarator
282
+ declarator: (parenthesized_declarator
283
+ (pointer_declarator
284
+ declarator: (field_identifier) @function)))
285
+
286
+ (preproc_function_def
287
+ name: (identifier) @function.macro)
288
+
289
+ (comment) @comment @spell
290
+
291
+ ((comment) @comment.documentation
292
+ (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
293
+
294
+ ; Parameters
295
+ (parameter_declaration
296
+ declarator: (identifier) @variable.parameter)
297
+
298
+ (parameter_declaration
299
+ declarator: (array_declarator) @variable.parameter)
300
+
301
+ (parameter_declaration
302
+ declarator: (pointer_declarator) @variable.parameter)
303
+
304
+ ; K&R functions
305
+ ; To enable support for K&R functions,
306
+ ; add the following lines to your own query config and uncomment them.
307
+ ; They are commented out as they'll conflict with C++
308
+ ; Note that you'll need to have `; extends` at the top of your query file.
309
+ ;
310
+ ; (parameter_list (identifier) @variable.parameter)
311
+ ;
312
+ ; (function_definition
313
+ ; declarator: _
314
+ ; (declaration
315
+ ; declarator: (identifier) @variable.parameter))
316
+ ;
317
+ ; (function_definition
318
+ ; declarator: _
319
+ ; (declaration
320
+ ; declarator: (array_declarator) @variable.parameter))
321
+ ;
322
+ ; (function_definition
323
+ ; declarator: _
324
+ ; (declaration
325
+ ; declarator: (pointer_declarator) @variable.parameter))
326
+ (preproc_params
327
+ (identifier) @variable.parameter)
328
+
329
+ [
330
+ "__attribute__"
331
+ "__declspec"
332
+ "__based"
333
+ "__cdecl"
334
+ "__clrcall"
335
+ "__stdcall"
336
+ "__fastcall"
337
+ "__thiscall"
338
+ "__vectorcall"
339
+ (ms_pointer_modifier)
340
+ (attribute_declaration)
341
+ ] @attribute