Pash-Project/Pash — pull request #182 by sburnicki (2013-12-04 19:55:24+00:00)
Title: Third step of scope integratiomn: Use of scopes, general fixes/cleanup about commands

As the last major step of the scope integration, the command invocation methods were
updated in order to use the new scope architecture. Main changes:

* Pash distinguishes correctly between scripts, functions, and script blocks.

* The ScriptProcessor is now a more general ScriptBlockProcessor that is able to
process all script-block-like structures (functions, scripts, and script-blocks)

* Depending on invocation method and type, Pash creates new scopes if needed
and updates the runspace's execution context if a command is (temporarily)
executed in a new scope. Therefore the CommandManager depends on the
Runspace, as it needs access to the currently active scope.

* The dot-sourcing implementation was fixed to work correctly. It only supported
scripts so far. Now dot-sourcing and ampersand invocation work with scripts,
script blocks, expression resulting in a script name and script blocks stored
in variables.

* There are new "end-to-end" unit tests that assure scopes work as intended for
variables and functions

* The way commands are parsed, found and executed changed in order to be easier,
less redundant and more straight-forward to understand.
A "command" is now a real command, i.e. one specific word. So Pash strongly
distiguishes between input, which needs to be parsed, and commands, that
are searched and processed. Parsable input is a Command with the IsScript flag,
which is also the desired behavior of the specification, while real commands
set this flag to false.
As a result Pash doesn't just try to parse the CommandText, if it didn't find a
command, but knows exactly when to parse input and when to search for a command.

With these changes, Pash fully supports scopes.