BUG: Fix support for builds in dirs with whitespace

Add escaping and quoting of dirs and enabled POSIX support in lexer.

Closes #4382.