elixir-lang / tree-sitter-iex Goto Github PK
View Code? Open in Web Editor NEWInteractive Elixir (IEx) grammar for tree-sitter
License: Apache License 2.0
Interactive Elixir (IEx) grammar for tree-sitter
License: Apache License 2.0
It would be great to integrate this grammar for GitHub highlighting. Note that this grammar is not likely to be used in files, but it would be useful for highlighting Markdown snippets, like this:
We first compute square of the numbers:
```iex
iex> list = Enum.map([1, 2, 3], fn x -> x * x end)
[1, 4, 9]
```
And that's how we would sum them up:
```iex
iex> Enum.sum(list)
14
```
@patrickt please let us know if you're open to integrating more specific grammars like this one.
We can host playground on GH pages and have CI updating the parser file. When we get to a nice setup we can do the same on tree-sitter-elixir.
Large IEx results may be formatted into multiple lines, for example:
iex> quote do
...> Enum.map(x, &(&1 + 1))
...> end
{{:., [], [{:__aliases__, [alias: false], [:Enum]}, :map]}, [],
[
{:x, [if_undefined: :apply], Elixir},
{:&, [], [{:+, [context: Elixir, import: Kernel], [{:&, [], [1]}, 1]}]}
]}
================================================================================
Multiline results
================================================================================
iex> quote do
...> Enum.map(x, &(&1 + 1))
...> end
{{:., [], [{:__aliases__, [alias: false], [:Enum]}, :map]}, [],
[
{:x, [if_undefined: :apply], Elixir},
{:&, [], [{:+, [context: Elixir, import: Kernel], [{:&, [], [1]}, 1]}]}
]}
--------------------------------------------------------------------------------
(source
(evaluation_block
(prompt_line
(prompt)
(expression))
(prompt_line
(prompt)
(expression))
(prompt_line
(prompt)
(expression))
(result)))
I'm pretty sure we will need to write a C scanner for this ๐
nvim-treesitter
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.iex = {
install_info = {
url = "~/projects/tree-sitter-iex", -- local path or git repo
-- url = "[email protected]:elixir-lang/tree-sitter-iex.git", -- local path or git repo
files = {"src/parser.c"}
},
-- filetype = "zu", -- if filetype does not agrees with parser name
-- used_by = {"bar", "baz"} -- additional filetypes that use this parser
}
I think the problem has to do with the filetype, once we sort this I would be happy to add some extra docs into the readme about how to install/use this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.