Skip to content

Commit

Permalink
Syntax: ST4 related tweaks of Interactive Shell syntax
Browse files Browse the repository at this point in the history
This commit inherits from Shell-Unix-Generic to scope `>` at bol via `prototype`
  • Loading branch information
deathaxe committed Feb 20, 2022
1 parent e4509eb commit 0ac2df9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
23 changes: 12 additions & 11 deletions syntaxes/Shell (for Markdown).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
---
name: Interactive Unix Shell
scope: source.shell.interactive.markdown
version: 2
hidden: true

extends: Packages/ShellScript/Shell-Unix-Generic.sublime-syntax

contexts:
prototype:
- meta_prepend: true
# continuation lines begin with `> `
- match: ^>(?=\s)
scope: comment.other.shell

main:
- match: ^(?=\$\s)
push: shell-interactive
- include: shell-statements
- include: statements

shell-interactive:
- match: ^\$(?=\s)
scope: comment.other.shell
push: shell-statements
with_prototype:
# continuation lines begin with `> `
- match: ^>(?=\s)
scope: comment.other.shell
- match: ^
pop: true

shell-statements:
- include: scope:source.shell
embed: statements
escape: (?<![^\\]\\)(?<![\\]{3})\n
6 changes: 3 additions & 3 deletions tests/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -1934,13 +1934,13 @@ unclosed_paren = (

```shell
function foo () {
| <- markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown meta.function.shell storage.type
| <- markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown meta.function.shell keyword.declaration.function.shell
}
| <- markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown meta.function.shell punctuation.section
| <- markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown meta.function.shell meta.compound.shell punctuation.section.compound.end.shell

$ ls ~
| <- markup.raw.code-fence.shell.markdown-gfm source.shell.interactive comment.other.shell
| ^^ meta.function-call.shell variable.function.shell
| ^^ meta.function-call.identifier.shell variable.function.shell
| ^^ meta.function-call.arguments.shell

output.txt
Expand Down

0 comments on commit 0ac2df9

Please sign in to comment.