-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# `@__END__` | ||
|
||
`throw(Jive.EndError())` | ||
|
||
```@docs | ||
Jive.@__END__ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# module Jive | ||
|
||
struct EndError <: Exception | ||
end | ||
|
||
function isenderror(ex::LoadError) | ||
if ex.error isa EndError | ||
return true | ||
elseif ex.error isa LoadError | ||
return isenderror(ex.error) | ||
else | ||
return false | ||
end | ||
end | ||
|
||
""" | ||
@__END__ | ||
`throw(Jive.EndError())` | ||
""" | ||
macro __END__() | ||
@eval function Base.showerror(io::IO, ex::LoadError, bt; backtrace=true) | ||
if isenderror(ex) | ||
printstyled(io, "@__END__", color=:cyan) | ||
print(io, " at ", basename(ex.file), ":", ex.line) | ||
else | ||
print(io, "Error while loading expression starting at ", ex.file, ":", ex.line) | ||
end | ||
end | ||
throw(EndError()) | ||
end | ||
|
||
# module Jive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
using Jive | ||
push!(stack, 10) | ||
@__END__ | ||
push!(stack, 20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module test_jive__END__ | ||
|
||
using Test | ||
|
||
stack = [] | ||
|
||
try | ||
include("included.jl") | ||
catch | ||
push!(stack, 1) | ||
end | ||
|
||
try | ||
include("included.jl") | ||
catch | ||
push!(stack, 2) | ||
end | ||
|
||
push!(stack, 3) | ||
|
||
@test stack == [10, 1, 10, 2, 3] | ||
|
||
end # module test_jive__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
using Jive # runtests | ||
runtests(@__DIR__, skip=["Example", "errors", "jive/onlyonce/heavy.jl"]) | ||
runtests(@__DIR__, skip=["Example", "errors", "jive/onlyonce/heavy.jl", "jive/__END__/included.jl"]) |