Skip to content

Commit 7ed50b9

Browse files
parse remote shell syntax (#4)
1 parent 5bbcde8 commit 7ed50b9

File tree

6 files changed

+232
-186
lines changed

6 files changed

+232
-186
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
A [tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for Elixir's "IEx" REPL syntax
66

7-
## Status
8-
9-
This grammar should be fairly complete. It could support more advanced iex syntax in the future, though, such as `iex(foo@name)1>`.
10-
117
## Example highlights
128

139
Injecting [`elixir-lang/tree-sitter-elixir`](https://github.com/elixir-lang/tree-sitter-elixir):

grammar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ module.exports = grammar({
1818
),
1919

2020
_default_prompt_line: ($) =>
21-
seq(alias(/iex(\(\d+\))?>/, $.prompt), optional($.expression)),
21+
seq(alias(/iex(\([^\)]+\)\d*)?>/, $.prompt), optional($.expression)),
2222

2323
_cont_prompt_line: ($) =>
24-
seq(alias(/\.\.\.(\(\d+\))?>/, $.prompt), optional($.expression)),
24+
seq(alias(/\.\.\.(\([^\)]+\)\d*)?>/, $.prompt), optional($.expression)),
2525

2626
expression: ($) => seq(ANYTHING, NEWLINE),
2727

src/grammar.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"type": "ALIAS",
6363
"content": {
6464
"type": "PATTERN",
65-
"value": "iex(\\(\\d+\\))?>"
65+
"value": "iex(\\([^\\)]+\\)\\d*)?>"
6666
},
6767
"named": true,
6868
"value": "prompt"
@@ -88,7 +88,7 @@
8888
"type": "ALIAS",
8989
"content": {
9090
"type": "PATTERN",
91-
"value": "\\.\\.\\.(\\(\\d+\\))?>"
91+
"value": "\\.\\.\\.(\\([^\\)]+\\)\\d*)?>"
9292
},
9393
"named": true,
9494
"value": "prompt"

0 commit comments

Comments
 (0)