Skip to content

Latest commit

 

History

History
86 lines (80 loc) · 2.08 KB

README.md

File metadata and controls

86 lines (80 loc) · 2.08 KB

tree-sitter-crystal

A WIP tree-sitter grammar for Crystal.

Status

  • Comments
  • Literals
    • nil
    • bool
    • float
    • integer
    • symbol
    • char
    • string
      • literals
      • interpolation
    • array
    • hash
    • array-or-hash-index-access (foo[0] or foo[:something])
    • range
    • regex
    • tuple
    • namedtuple
    • proc
    • command
      • literals
      • interpolation
  • Assignment
    • to local var
    • to instance var
    • to class var
    • to constant
    • to "assignment methods"/properties
    • multiple-assignment
  • Binary operations
    • basic support
    • per-operator precedence definitions
  • Variables
    • local variables
    • instance variables
    • class variables
    • constants
  • Control expressions
    • if/else
      • "block-level" form (if something ; stuff ; else ; end)
      • "suffix" form (foo = bar if something)
    • unless
      • "block-level" form (unless something ; stuff ; else ; end)
      • "suffix" form (foo = bar unless something)
    • case
    • while
    • until
  • require statements
  • Type grammar
    • Basic "bare" types (e.g. Foo)
    • Namespaced types (e.g. Some::Namespace::Foo)
    • Generic types (e.g. Foo(T) and Foo(A, B))
    • Union types
    • Class definitions
    • Module definitions
      • include statements
    • Structs
    • Enums
    • Type annotations
      • in variable declarations
      • in method parameter declarations
      • as method return types
    • alias statements
  • Blocks
    • do blocks (with and without parameters)
    • {|x| whatever } blocks (with parameters only)
    • begin...rescue...end blocks
  • Method definitions
  • Method calls
  • "Bare" function calls (like puts 1 and puts(1))
  • Splats
    • in method calls
    • in method definitions
  • Macros
  • Annotations

Developing

To test tree-sitter generate && tree-sitter test (or just npm test)