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

Minor tweaks to remove method ambiguities and argument ambiguities #295

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions src/parser_api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ function Base.showerror(io::IO, err::ParseError)
show_diagnostics(io, err.diagnostics, err.source)
end

Base.display_error(io::IO, err::ParseError, bt) = Base.showerror(io, err, bt)


"""
parse!(stream::ParseStream; rule=:all)

Expand Down
8 changes: 8 additions & 0 deletions src/syntax_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ mutable struct TreeNode{NodeData} # ? prevent others from using this with Node
parent::Union{Nothing,TreeNode{NodeData}}
children::Union{Nothing,Vector{TreeNode{NodeData}}}
data::Union{Nothing,NodeData}

# Use this constructor rather than the automatically generated one to pass
# Test.detect_unbound_args() test in Base.
function TreeNode{NodeData}(parent::Union{Nothing,TreeNode{NodeData}},
children::Union{Nothing,Vector{TreeNode{NodeData}}},
data::Union{Nothing,NodeData}) where {NodeData}
new{NodeData}(parent, children, data)
end
end

# Implement "pass-through" semantics for field access: access fields of `data`
Expand Down
2 changes: 1 addition & 1 deletion src/tokenize.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Tokenize

export tokenize, untokenize, Tokens
export tokenize, untokenize

using ..JuliaSyntax: JuliaSyntax, Kind, @K_str, @KSet_str

Expand Down
7 changes: 7 additions & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@
@test ps("XX", fgcolor=:red, bgcolor=:green, href="https://www.example.com") ==
"\e]8;;https://www.example.com\e\\\e[31m\e[42mXX\e[0;0m\e]8;;\e\\"
end

@testset "ambiguities" begin
if VERSION >= v"1.8"
@test detect_ambiguities(JuliaSyntax) == []
@test detect_unbound_args(JuliaSyntax) == []
end
end
Loading