View Source Slime.Parser.Preprocessor (slime v1.3.1)

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

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.

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.