Skip to content

Parser Refactoring, Unit Tests Added, & New Features

Michael Aaron Murphy requested to merge mmstick:refactor_parsers into master

Refactoring

This will primarily refactor all the parsing-related content into a new parser module. The pipeline parsing logic was removed from the peg module and placed into it's own module.

Unit Tests

Unit tests were added for the new for grammar and statement splitter, so there's more coverage now. A number of tests were removed for the pipleline logic as it's no valid since landing the statement splitter.

StatementSplitter Improvements

The statement splitter was improved to now ignore comments, as it should. The following command:

echo $(echo one #two); echo three # four

Will thus split into:

echo $(echo one #two)
echo three

(Seems highlight.js doesn't properly parse comments)

The statement splitter is now also integrated with the rest of the shell's functionality (scripts, init script, source, etc.) instead of just the REPL shell alone.

Process Recursion

It's now possible to perform process recursion, like so:

echo $(echo $(echo one))

Context History Improvement

In addition, a small change was appended that improves the usefulness of navigating history when a previous command contained multiple statements, which also disables the context history for commands executed via scripts (as other shells do it).

Merge request reports