diff --git a/base/Base.jl b/base/Base.jl index 63728fdba3e4e..ed234bdbc5893 100644 --- a/base/Base.jl +++ b/base/Base.jl @@ -512,6 +512,11 @@ function __init__() if haskey(ENV, "JULIA_MAX_NUM_PRECOMPILE_FILES") MAX_NUM_PRECOMPILE_FILES[] = parse(Int, ENV["JULIA_MAX_NUM_PRECOMPILE_FILES"]) end + if get(ENV, "JULIA_USE_NEW_PARSER", "true") == "true" + JuliaSyntax = require(PkgId( + UUID((0x70703baa_626e_46a2, 0xa12c_08ffd08c73b4)), "JuliaSyntax")) + JuliaSyntax.enable_in_core!() + end nothing end diff --git a/base/boot.jl b/base/boot.jl index 5f3b99df1c716..cc2cec5ec6e57 100644 --- a/base/boot.jl +++ b/base/boot.jl @@ -826,9 +826,11 @@ GlobalRef(m::Module, s::Symbol) = GlobalRef(m, s, bitcast(Ptr{Nothing}, 0)) # `_parse` must return an `svec` containing an `Expr` and the new offset as an # `Int`. # -# The internal jl_parse which will call into Core._parse if not `nothing`. +# The internal jl_parse will call into Core._parse if not `nothing`. _parse = nothing +_setparser!(parser) = setglobal!(Core, :_parse, parser) + # support for deprecated uses of internal _apply function _apply(x...) = Core._apply_iterate(Main.Base.iterate, x...) diff --git a/base/compiler/compiler.jl b/base/compiler/compiler.jl index 3c41c353e86ad..b6e8b2b57e383 100644 --- a/base/compiler/compiler.jl +++ b/base/compiler/compiler.jl @@ -170,7 +170,7 @@ include("compiler/bootstrap.jl") ccall(:jl_set_typeinf_func, Cvoid, (Any,), typeinf_ext_toplevel) include("compiler/parsing.jl") -Core.eval(Core, :(_parse = Compiler.fl_parse)) +Core._setparser!(fl_parse) end # baremodule Compiler )) diff --git a/base/sysimg.jl b/base/sysimg.jl index 5a14bf5bfd3b9..00c145c5b8d61 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -38,6 +38,7 @@ let :Unicode, # 1-depth packages + :JuliaSyntax, :LinearAlgebra, :Markdown, :Printf, diff --git a/contrib/generate_precompile.jl b/contrib/generate_precompile.jl index acd61be502465..b5ea9bcb58f37 100644 --- a/contrib/generate_precompile.jl +++ b/contrib/generate_precompile.jl @@ -156,6 +156,13 @@ if Artifacts !== nothing """ end +JuliaSyntax = get(Base.loaded_modules, + Base.PkgId(Base.UUID("70703baa-626e-46a2-a12c-08ffd08c73b4"), "JuliaSyntax"), + nothing) +if JuliaSyntax !== nothing + precompile_script *= read(joinpath(pkgdir(JuliaSyntax), + "sysimage", "precompile_exec.jl"), String) * "\n" +end Pkg = get(Base.loaded_modules, Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"), diff --git a/deps/checksums/JuliaSyntax-d3d8fdeaea37bcae05191cad50a326e608035d97.tar.gz/md5 b/deps/checksums/JuliaSyntax-d3d8fdeaea37bcae05191cad50a326e608035d97.tar.gz/md5 new file mode 100644 index 0000000000000..cf4e98bec4a17 --- /dev/null +++ b/deps/checksums/JuliaSyntax-d3d8fdeaea37bcae05191cad50a326e608035d97.tar.gz/md5 @@ -0,0 +1 @@ +29ccd296e538403829ffd90b3cce67d8 diff --git a/deps/checksums/JuliaSyntax-d3d8fdeaea37bcae05191cad50a326e608035d97.tar.gz/sha512 b/deps/checksums/JuliaSyntax-d3d8fdeaea37bcae05191cad50a326e608035d97.tar.gz/sha512 new file mode 100644 index 0000000000000..d11ea973b1119 --- /dev/null +++ b/deps/checksums/JuliaSyntax-d3d8fdeaea37bcae05191cad50a326e608035d97.tar.gz/sha512 @@ -0,0 +1 @@ +b3c26d6f7880f069b1f6f21ee3978cd3e797acd9ca6fb1e7ece28cf4dea576872bed3e8c3121d1d6cfe559518a17004595139f9978fd2591669cbe8128f7c1ac diff --git a/stdlib/.gitignore b/stdlib/.gitignore index ffbc2f12f52da..05cc5cfc3eecd 100644 --- a/stdlib/.gitignore +++ b/stdlib/.gitignore @@ -19,5 +19,7 @@ /SparseArrays /SHA-* /SHA +/JuliaSyntax-* +/JuliaSyntax /*_jll/StdlibArtifacts.toml /*/Manifest.toml diff --git a/stdlib/JuliaSyntax.version b/stdlib/JuliaSyntax.version new file mode 100644 index 0000000000000..cc66c1185d796 --- /dev/null +++ b/stdlib/JuliaSyntax.version @@ -0,0 +1,4 @@ +JULIASYNTAX_BRANCH = main +JULIASYNTAX_SHA1 = 6465cceaf4b3766e66e4338c15a38e6c7281b1e3 +JULIASYNTAX_GIT_URL := https://github.com/JuliaLang/JuliaSyntax.jl.git +JULIASYNTAX_TAR_URL = https://api.github.com/repos/JuliaLang/JuliaSyntax.jl/tarball/$1 diff --git a/stdlib/Makefile b/stdlib/Makefile index d45be468626cd..1473dd1b9193e 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -47,7 +47,7 @@ STDLIBS = Artifacts Base64 CRC32c Dates Distributed FileWatching \ SharedArrays Sockets SparseArrays SuiteSparse Test TOML Unicode UUIDs \ $(JLL_NAMES) -STDLIBS_EXT = Pkg Statistics LibCURL Downloads ArgTools Tar NetworkOptions SuiteSparse SparseArrays SHA +STDLIBS_EXT = Pkg Statistics LibCURL Downloads ArgTools Tar NetworkOptions SuiteSparse SparseArrays SHA JuliaSyntax $(foreach module, $(STDLIBS_EXT), $(eval $(call stdlib-external,$(module),$(shell echo $(module) | tr a-z A-Z))))