Module Parslet::Atoms::CanFlatten
In: lib/parslet/atoms/can_flatten.rb

A series of helper functions that have the common topic of flattening result values into the intermediary tree that consists of Ruby Hashes and Arrays.

This module has one main function, flatten, that takes an annotated structure as input and returns the reduced form that users expect from Atom#parse.

NOTE: Since all of these functions are just that, functions without side effects, they are in a module and not in a class. Its hard to draw the line sometimes, but this is beyond.

Methods

Public Instance methods

Lisp style fold left where the first element builds the basis for an inject.

That annoying warning ‘Duplicate subtrees while merging result’ comes from here. You should add more ’.as(…)’ names to your intermediary tree.

[Validate]