From 2ec5453dbdbd4c51ce11969eb26fbbce52eb6a55 Mon Sep 17 00:00:00 2001 From: c42f Date: Thu, 27 Apr 2023 07:05:51 +1000 Subject: [PATCH 1/4] Bump to 0.3.5 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index c5594ec2..bc83aa5f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "JuliaSyntax" uuid = "70703baa-626e-46a2-a12c-08ffd08c73b4" authors = ["Chris Foster and contributors"] -version = "0.3.4" +version = "0.3.5" [compat] julia = "1.0" From b24fe07420802834bd44ce2a6506950acf10b9b1 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Wed, 26 Apr 2023 11:36:02 +0200 Subject: [PATCH 2/4] make the global `_token_error_descriptions` variable const (#255) --- src/kinds.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kinds.jl b/src/kinds.jl index 3b5fa1bd..24bab68e 100644 --- a/src/kinds.jl +++ b/src/kinds.jl @@ -1062,7 +1062,7 @@ function untokenize(k::Kind; unique=true) end # Error kind => description -_token_error_descriptions = Dict{Kind, String}( +const _token_error_descriptions = Dict{Kind, String}( K"ErrorEofMultiComment" => "unterminated multi-line comment #= ... =#", K"ErrorInvalidNumericConstant" => "invalid numeric constant", K"ErrorHexFloatMustContainP" => "hex float literal must contain `p` or `P`", From 154ae10f32bd8f52d0422bc667be03d167b2db65 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Wed, 26 Apr 2023 12:31:35 +0200 Subject: [PATCH 3/4] specialize on the number of varargs for `bump_split` (#254) --- src/parse_stream.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse_stream.jl b/src/parse_stream.jl index 2189da23..580c246d 100644 --- a/src/parse_stream.jl +++ b/src/parse_stream.jl @@ -717,7 +717,7 @@ example TODO: Are these the only cases? Can we replace this general utility with a simpler one which only splits preceding dots? """ -function bump_split(stream::ParseStream, split_spec...) +function bump_split(stream::ParseStream, split_spec::Vararg{Any, N}) where {N} tok = stream.lookahead[stream.lookahead_index] stream.lookahead_index += 1 b = _next_byte(stream) From 1ca505b69969c04136a0c774f81efaef8037bede Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Wed, 26 Apr 2023 12:31:45 +0200 Subject: [PATCH 4/4] avoid a runtime dispatch when converting to expr (#257) --- src/expr.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/expr.jl b/src/expr.jl index 61ec2e75..7efe9a55 100644 --- a/src/expr.jl +++ b/src/expr.jl @@ -11,7 +11,7 @@ function is_stringchunk(node) return k == K"String" || k == K"CmdString" end -function reorder_parameters!(args, params_pos) +function reorder_parameters!(args::Vector{Any}, params_pos) p = 0 for i = length(args):-1:1 if !Meta.isexpr(args[i], :parameters) @@ -24,7 +24,7 @@ function reorder_parameters!(args, params_pos) end # nest frankentuples parameters sections for i = length(args)-1:-1:p - pushfirst!(args[i].args, pop!(args)) + pushfirst!((args[i]::Expr).args, pop!(args)) end # Move parameters to args[params_pos] insert!(args, params_pos, pop!(args))