Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
REPL6: Handle exceptions that trigger multi-line mode
  • Loading branch information
hoelzro committed Mar 4, 2016
1 parent 3155d15 commit dcb9738
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/core/REPL.pm
Expand Up @@ -159,8 +159,26 @@ class REPL is export { # XXX no need for is export later
}

method eval(Mu \SELF, Mu \super, Mu \code, Mu \args, Mu \adverbs) {
my \result = super.(SELF, code, |@(args), |%(adverbs));
# XXX we don't get a context until our next readline?
result
try {
CATCH {
when X::Syntax::Missing {
if .pos == code.chars {
adverbs<more_input> = 1;
return;
}
.throw;
}

when X::Comp::FailGoal {
if .pos == code.chars {
adverbs<more_input> = 1;
return;
}
.throw;
}
}

super.(SELF, code, |@(args), |%(adverbs))
}
}
}

0 comments on commit dcb9738

Please sign in to comment.