Esperanto.Parser behaviour (esperanto v0.1.0)

Parser interface

Link to this section Summary

Callbacks

Enchant parser returning a new tree paremters

Parse given input paremters

Check if parser should handle current walker input paremters

Link to this section Types

Specs

tree() :: any()

Link to this section Functions

Link to this function

to_xml(tree, opts \\ [])

Link to this section Callbacks

Link to this callback

enchant_parser(tree, arg2, integer)

(optional)

Specs

enchant_parser(tree(), NaryTree.Node.t(), integer()) :: tree()

Enchant parser returning a new tree paremters:

  • tree- Current AST tree
  • tree- the node being created
  • parent_id- id of the parent node returns: a new enchanted tree
Link to this callback

parse(walker, tree, parent_id, opts)

Specs

parse(
  walker :: Esperanto.Walker.t(),
  tree :: tree(),
  parent_id :: integer(),
  opts :: keyword()
) :: {tree(), Esperanto.Walker.t()}

Parse given input paremters:

  • walker- Parse is responsible to walk trough input
  • tree- Current AST tree
  • parent_id- id of the parent node
  • opts- id of the parent node returns: A tuple with the new tree and new walker
Link to this callback

should_parse(walker, tree, parent_id, opts)

Specs

should_parse(
  walker :: Esperanto.Walker.t(),
  tree :: tree(),
  parent_id :: integer(),
  opts :: keyword()
) :: boolean()

Check if parser should handle current walker input paremters:

  • walker- Parse is responsible to walk trough input
  • tree- Current AST tree
  • parent_id- id of the parent node
  • opts- id of the parent node returns: true if the the parse should be used. Note that if two parsers returns true an AmbigousSyntaxError is raised