slime v1.2.0 Slime.Parser.Preprocessor View Source

This module helps to process input and insert indents and dedents to simplify parser design.

Link to this section Summary

Functions

Takes an input binary and inserts virtual indent and dedent

Counts indent size by indent string using :tab_size config option

Removes trailing whitespace, leaving newlines intact

Link to this section Functions

Takes an input binary and inserts virtual indent and dedent.

Examples:

iex> Slime.Parser.Preprocessor.indent("t\n p")
"t\n p"

iex> Slime.Parser.Preprocessor.indent("t\n p\n  a\nh")
"t\n p\n  a\nh"

Counts indent size by indent string using :tab_size config option

Examples:

iex> Slime.Parser.Preprocessor.indent_size("    ")
4

iex> Slime.Parser.Preprocessor.indent_size("    ")
4

iex> Slime.Parser.Preprocessor.indent_size("")
0
Link to this function remove_trailing_spaces(input) View Source

Removes trailing whitespace, leaving newlines intact.