ESTree

Defines structs that represent the JavaScript AST nodes from the ESTree spec.

ESTree Spec

Also includes a JavaScript AST to JavaScript code generator.

alias ESTree.Tools.Builder
alias ESTree.Tools.Generator

ast = Builder.array_expression([
  Builder.literal(1),
  Builder.identifier(:a)
])

Generator.generate(ast)
#"[1, a]"
Source

Types

unary_operator :: :- | :+ | :! | :"~" | :typeof | :void | :delete

binary_operator :: :== | :!= | :=== | :!== | :< | :<= | :> | :>= | :"<<" | :">>" | :>>> | :+ | :- | :* | :/ | :% | :| | :^ | :& | :in | :instanceof

logical_operator :: :|| | :&&

assignment_operator :: := | :"+=" | :"-=" | :"*=" | :"/=" | :"%=" | :"<<=" | :">>=" | :">>>=" | :"|=" | :"^=" | :"&="

update_operator :: :++ | :--