Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow --repl-mode even with parameters #676

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/HLL/Compiler.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,18 @@ class HLL::Compiler does HLL::Backend::Default {
}
}
elsif !@a || (@a == 1 && @a[0] eq '-') {
# Is STDIN a TTY display? If so, start the REPL, otherwise, simply
# assume the program to eval is given on STDIN.
my $force := %adverbs<repl-mode>//'';
my $wants-interactive := $force
?? $force eq 'interactive'
?? 1 !! $force eq 'non-interactive'
?? 0 !! self.panic(
"Unknown REPL mode '$force'. Valid values"
~ " are 'non-interactive' and 'interactive'"
)
!! stdin().t();
# Is STDIN a TTY display? If so, start the REPL, otherwise,
# simply assume the program to eval is given on STDIN.
$result := stdin().t()
?? self.interactive(|%adverbs)
!! self.evalfiles('-', |%adverbs);
}
elsif %adverbs<repl-mode> -> $repl-mode {
my $wants-interactive := $repl-mode eq 'interactive'
?? 1
!! $repl-mode eq 'non-interactive'
?? 0
!! self.panic("Unknown REPL mode '$repl-mode'. Valid values are 'non-interactive' and 'interactive'");
$result := $wants-interactive
?? self.interactive(|%adverbs)
!! self.evalfiles('-', |%adverbs);
Expand Down