diff --git a/bin/iutils b/bin/iutils index abd5b22..6c8797a 100755 --- a/bin/iutils +++ b/bin/iutils @@ -9,7 +9,7 @@ my $ide = IUtils::IDEMode.new(); my @res = $ide.version; say @res[0][1][1][1][0]; -@res = $ide.load-file: '.tmp/test.idr'; +@res = $ide.load-file: '.tmp/test.nope'; say @res.raku; @res = $ide.interpret: ':exec works >>= print'; diff --git a/lib/IUtils/IDEMode.rakumod b/lib/IUtils/IDEMode.rakumod index 4c8d765..0df72c8 100644 --- a/lib/IUtils/IDEMode.rakumod +++ b/lib/IUtils/IDEMode.rakumod @@ -43,11 +43,7 @@ class SExp::Actions { } method str-content($/) { - if $/.Str && $0 { - make $/.Str.subst(/\\(.)/, {$0}, :g) - } else { - make '' - } + make $/.Str.subst(/\\(.)/, {$0}, :g) } } @@ -94,7 +90,6 @@ method process-protocol-version() { method read-sexp() { my $len = $!socket.read(6).decode('utf8'); my $msg = $!socket.read(:bin, $len.parse-base(16)).decode('utf8'); - # say "Got: ", $len, $msg; SExp.parse($msg, actions => SExp::Actions).made } @@ -119,7 +114,10 @@ method send-command(*@cmd) { my $resp = self.read-sexp(); @responses.push($resp); - # TODO: Die on error + if $resp[1][0] eq ':error' && $resp[2] == $id { + die "Idris error: ", $resp[1][1]; + } + if $resp[0] eq ':return' && $resp[2] == $id { return @responses; }