nest PreMain inside NimMain for easier consumption of static libraries developed in Nimrod

fixes many uses of $N instead of $n for new lines that don't affect #line directives
fix the error "only proc headers can feature pragmas" when compiling in JS mode