Eno\Parser » parse

parse($input) → Section
parse($input, $options) → Section

Parse a string in eno notation.

enocolor: blue
phpParser::parse($input);  // returns [Section document elements=1]

                                                             // Errors will be ...
Parser::parse($input, [ 'locale' => 'es' ]);                 // In spanish - ¡hola!
Parser::parse($input, [ 'reporter' => HTML ]);               // HTML for e.g. web integration
Parser::parse($input, [ 'reporter' => Terminal ]);           // Colored for terminal output
Parser::parse($input, [ 'source_label' => 'my-file.eno' ]);  // Annotated with a label as context
Parser::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

A Section representing the document.