Skip to content
This repository has been archived by the owner on Oct 9, 2021. It is now read-only.

wingyplus/tree-sitter-elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: This repository is no longer maintain. Please use https://github.com/elixir-lang/tree-sitter-elixir which's a tree-sitter implementation maintained by Elixir Team.

tree-sitter-elixir

Build Status

Elixir grammar for tree-sitter, you can try it out in the playground.

References

Status

Current status (not mentioned parts are not implemented):

map

  • empty
  • with one key and value
  • with many keys and values
  • error

struct

  • empty
  • with one key and value
  • with many keys and values
  • error with string key

bitstring

  • empty
  • with integer
  • with integer and type-specifier
  • with integer and multiple type-specifier
  • with integer and bit-pattern size
  • with integer and bit-pattern size and type-specifier
  • with integer and bit-pattern size and multiple type-specifiers
  • with float
  • with float and type-specifier
  • with float and multiple type-specifier
  • with float and bit-pattern size
  • with float and bit-pattern size and type-specifier
  • with float and bit-pattern size and multiple type-specifiers
  • with string
  • with many components

boolean

  • Boolean

number

  • Integer
  • Negative
  • Integer Multi Digits
  • Integer With Underscore
  • Binary Integer
  • Binary Integer With Underscore
  • Hex Integer
  • Hex Integer With Underscore
  • Octal Integer
  • Octal Integer With Underscore
  • Float
  • Float large
  • Float With Underscore
  • Float With Underscore + Scientific Notation
  • Float With Underscore + Scientific Notation 2
  • Float negative
  • Float with negative exponential/scientific notation

module_attribute

  • moduledoc attribute

atom

sigil

  • empty
  • string
  • braced
  • multiline
  • regex with modifier
  • only single char sigil

module_functions

  • zero arity function
  • zero arity function with parens
  • single arity function
  • plural arity function
  • short hand function

string

  • String - Single line
  • String - Single line with escaped double quote
  • String - Multi Line
  • String - Concatenation
  • String - Multi Line with internal double quotes

list

  • List - Empty list
  • List With Elements
  • List - Error
  • List - Trailing Separator

module

  • Module with atom
  • Module with Elixir uppercase atom

tuple

  • Tuple
  • Tuple - Error
  • Tuple - Trailing Separator

Anonymous Functions

  • without args
  • multiple clauses
  • multiple clauses with guard

variable

  • snake_case
  • camelCase
  • ends in ?
  • ends in !

keyword_list:

  • Keyword empty list
  • Keyword list shorthand syntax
  • Keyword list tuple syntax
  • Keyword list error - shorthand before tuple syntax
  • Keyword list mixed - tuples + shorthand

charlist

  • Charlist - Single line
  • Single line with escaped quote
  • Charlist - Multi line
  • Charlist - Multi line with internal quote
  • Char - Single
  • Char - list

string_interpolation

  • basic
  • with operator
  • with text
  • in mutil line strings
  • interpolating strings in strings
  • interpolating strings in strings with operator

operators

  • Unary operators
  • Operators with left associativity
  • op right associativity

for_comprehension

  • For - list generator
  • For - bistring generator
  • For - filter tuple
  • For - square list
  • For - with options (into:, reduce: , unique: )

FAQ

Why? Doesn't Elixir ship with a parser?

Tree-sitter aims to be a tool to easily produce a fast, embeddable parser for tools like syntax highlighting in editors, more richer diff analysis in GitHub and code (security) analysers. As LSP is a tool meant to be used by all editors and for all languages, such is Tree-sitter when it comes to parsers.

What's the current status? Is it done yet?

Lots of the syntax has already been done, but there's also lots to be done. In case you want a taste, take it for a spin on the playground

(How) Can I contribute?

  • Try it out, see if you find bugs which are not part of the issues list (amd report them plz)
  • If you have time and like to code: take a look at the issues list and call dibs on one
  • If you see spelling mistakes, would like to make the playground better in any way or think you can improve this project in any other way, feel free to reach out (either via issues or in private)

I have a different question / would like to chat in private

Feel free to open an issue or post it on Elixir Forum with your question. :)

About

Tree Sitter grammar for Elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages