Skip to main content

Crate treesitter_types_elixir

Crate treesitter_types_elixir 

Source
Expand description

Strongly-typed AST types for Elixir, auto-generated from tree-sitter-elixir’s node-types.json.

This crate is generated by treesitter-types and is automatically kept up to date when a new version of the grammar crate is released.

See the Tree-sitter project for more information about the underlying parser framework.

§Example

use treesitter_types_elixir::*;

// A minimal Elixir hello-world program.
let src = b"\
defmodule Hello do
  def world do
    IO.puts(\"Hello, World!\")
  end
end
";

// Parse the source with tree-sitter and convert into typed AST.
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_elixir::LANGUAGE.into()).unwrap();
let tree = parser.parse(src, None).unwrap();
let source = Source::from_node(tree.root_node(), src).unwrap();

// The source has one top-level child: the `defmodule` call.
assert_eq!(source.children.len(), 1);
assert_eq!(source.span.start.row, 0);
assert!(source.span.end.row >= 4);

Re-exports§

pub use tree_sitter_elixir;
pub use treesitter_types::tree_sitter;

Structs§

AccessCall
AfterBlock
Alias
AnonymousFunction
Arguments
Atom
BinaryOperator
Bitstring
Block
Body
Boolean
Call
CatchBlock
Char
Charlist
Comment
DoBlock
Dot
ElseBlock
EscapeSequence
Float
Identifier
Integer
Interpolation
Keyword
Keywords
List
Map
MapContent
Nil
OperatorIdentifier
Pair
QuotedAtom
QuotedContent
QuotedKeyword
RescueBlock
Sigil
SigilModifiers
SigilName
Source
Span
StabClause
String
Struct
Tuple
UnaryOperator

Enums§

AccessCallKey
AccessCallTarget
AfterBlockChildren
AnyNode
ArgumentsChildren
BinaryOperatorLeft
BinaryOperatorOperator
BinaryOperatorRight
BitstringChildren
BlockChildren
BodyChildren
CallChildren
CallTarget
CatchBlockChildren
CharlistChildren
CharlistQuotedEnd
CharlistQuotedStart
DoBlockChildren
DotLeft
DotOperator
DotRight
ElseBlockChildren
InterpolationChildren
ListChildren
MapChildren
MapContentChildren
PairKey
PairValue
ParseError
QuotedAtomChildren
QuotedAtomQuotedEnd
QuotedAtomQuotedStart
QuotedKeywordChildren
QuotedKeywordQuotedEnd
QuotedKeywordQuotedStart
RescueBlockChildren
SigilChildren
SigilQuotedEnd
SigilQuotedStart
SourceChildren
StabClauseLeft
StabClauseOperator
StringChildren
StringQuotedEnd
StringQuotedStart
StructChildren
TupleChildren
UnaryOperatorOperand
UnaryOperatorOperator

Traits§

FromNode
Every generated struct and enum implements this.
LeafNode
Implemented by every generated leaf type (identifiers, literals, etc.)
Spanned
Implemented by every generated type that has a source location.