Eno » ::parse

parse(input) → Eno::Section
parse(input, options) → Eno::Section

Parse a string in eno notation.

enocolor: blue
rubyEno.parse(input)  #=> #<Eno::Section document elements=1>

                                                      # Errors will be ...
Eno.parse(input, locale: 'es')                        # In spanish - ¡hola!
Eno.parse(input, reporter: Eno::Reporters::HTML)      # HTML for e.g. web integration
Eno.parse(input, reporter: Eno::Reporters::Terminal)  # Colored for terminal output
Eno.parse(input, source_label: 'my-file.eno')         # Annotated with a label as context
Eno.parse(input, zero_indexing: true)                 # Counting line and column numbers from 0

Parameters

input

A string containing text in eno notation.

options

locale

A string specifying the code of the locale to use for error messages (e.g. 'de', 'es'), by default 'en'.

reporter

One of Eno::Reporters::Text, Eno::Reporters::HTML, Eno::Reporters::Terminal.

source_label

A string that labels where the input comes from (e.g. a filename), this is included with error messages to help the user located the file.

zero_indexing

true or false (default), set true to display 0,1,2,.. line and column numbers in all error messages instead of the default 1,2,3,.. indexing.

Return value

An Eno::Section representing the document.