-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from colinfang/dev
Support Julia v0.7
- Loading branch information
Showing
8 changed files
with
61 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ os: | |
- linux | ||
- osx | ||
julia: | ||
- 0.6 | ||
- 0.7 | ||
- 1.0 | ||
- nightly | ||
notifications: | ||
email: false |
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,12 @@ | ||
name = "MiniLogging" | ||
uuid = "f59402ec-0262-5707-a561-770af94bc5a6" | ||
keywords = ["logging", "log"] | ||
license = "MIT" | ||
desc = "Mini hierarchical logging system like Python logging" | ||
version = "0.2" | ||
|
||
[extras] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test"] |
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 +1 @@ | ||
julia 0.6 0.7- | ||
julia 0.7 |
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
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,32 +1,40 @@ | ||
immutable Ancestors | ||
struct Ancestors | ||
node::String | ||
|
||
function Ancestors(node::String) | ||
if endswith(node, '.') | ||
if endswith(node, '.') || startswith(node, '.') | ||
error("Invalid node $node - Cannot end with `.`") | ||
end | ||
new(node) | ||
end | ||
end | ||
|
||
Base.start(x::Ancestors) = endof(x.node) | ||
|
||
function Base.next(a::Ancestors, state) | ||
node = a.node | ||
i = rsearch(node, '.', state) | ||
if i > 1 | ||
state = prevind(node, i) | ||
function Base.iterate(x::Ancestors, state=nothing) | ||
node = x.node | ||
if state == 0 || isempty(node) | ||
return nothing | ||
end | ||
|
||
if state == nothing | ||
state = lastindex(node) | ||
end | ||
|
||
r = findprev(".", node, state) | ||
if r == nothing | ||
return "", 0 | ||
else | ||
@assert r.start == r.stop | ||
state = prevind(node, r.start) | ||
if node[state] == '.' | ||
error("Invalid node $node - Cannot have `..`") | ||
end | ||
node[1:state], state | ||
else | ||
"", 0 | ||
return node[1:state], state | ||
end | ||
end | ||
|
||
Base.done(::Ancestors, state) = state < 1 | ||
Base.iteratorsize(::Type{Ancestors}) = Base.SizeUnknown() | ||
|
||
Base.IteratorSize(::Type{Ancestors}) = Base.SizeUnknown() | ||
Base.eltype(::Type{Ancestors}) = String | ||
|
||
is_ancestor_or_self(ancestor::String, descendant::String) = startswith(descendant, ancestor) |
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