Eden.Parser (eden v2.1.0)
Provides a single function that returns an Eden.Parser.Node
struct, which is the :root node of the parse tree.
Link to this section Summary
Functions
Takes a string and returns the root node of the parse tree.
Link to this section Functions
Link to this function
parse(input, opts \\ [location: false])
Takes a string and returns the root node of the parse tree.
All nodes are an Eden.Parser.Node struct, each of which has a :type,
a :value and an optional :location property.
The returned node is always of type :root, whose children are all the
expressions found in the string provided.
Options:
:location- abooleanthat determines if nodes should include row and column information.
Examples
iex> Eden.Parser.parse("nil")
:root
:nil "nil"
iex> Eden.Parse.parse("nil", location: true)
:root
:nil "nil" (1,0)
iex> Eden.Parse.parse("[1 2 3]")
:root
:vector
:integer "1"
:integer "2"
:integer "3"
iex> Eden.Parse.parse("[1 2 3]", location: true)
:root
:vector (1,0)
:integer "1" (1,1)
:integer "2" (1,3)
:integer "3" (1,5)