don't allow expressions outside of functions (besides REPL)
Right now if the brightscript runtime executes a file, it will execute every expression it finds outside of a function. This doesn't match the brightscript implementation where expressions must be inside functions.
...
print "running something"
sub Main()
print "in showChannelSGScreen"
...
which raises a syntax error the following error:
Syntax Error. (compile error &h02) in pkg:/source/Main.brs(10)
Should we match the device implementation and look for a main function, or should we enable a flag to toggle it so we can still run expressions in the REPL?
This is a tough one – node handles it ostensibly by assigning the result of the expression to $_ and printing $_. That won't work in BrightScript because – unlike JavaScript – BrightScript Doesn't support right-associative assignments (e.g. let foo = bar = baz = qux;).
This might require a separate parser entirely, or maybe a separate mode for the parser? Not too sure yet.