-
Notifications
You must be signed in to change notification settings - Fork 16
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
Defining new Lexer result in LoadError
due to evaluation in module Lexers
#44
Comments
Could you provide some additional details for this? (I've not touched the codebase in a very long time... it's likely to be something to do with Line 119 in 6db0259
|
@chengchingwen could you see whether the following patch fixes things for you? diff --git a/src/Lexers.jl b/src/Lexers.jl
index a808ff4..5dfbc63 100644
--- a/src/Lexers.jl
+++ b/src/Lexers.jl
@@ -48,7 +48,7 @@ macro lexer(T, dict)
# @generated $(Compiler).lex!{S}(ctx::Context, ::Type{$tx}, ::State{S}) =
# compile($tx, S, data)
# end
- $(Compiler).compile_lexer($(@__MODULE__), $tx)
+ $(Compiler).compile_lexer($(__module__), $tx)
$tx
end
end |
I'm using Julia v1.6 julia> versioninfo()
Julia Version 1.6.1-pre.1
Commit 9283b6c7a7 (2021-04-01 07:14 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core(TM) i7-7800X CPU @ 3.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake-avx512)
Environment:
JULIA_NUM_THREADS = 8 The error can be reproduce by simply pasting the And here is the full error log:
and the file: module Testhi
using Highlights
using Highlights.Lexers
using Highlights.Tokens
abstract type CommentLexer <: AbstractLexer end
@lexer CommentLexer Dict(
:name => "Comments",
:description => "A C-style comment lexer.",
:tokens => Dict(
:root => [
(r"//.*\n", COMMENT_SINGLE),
(r"/\*", COMMENT_MULTILINE, :multiline_comments),
(r"[^/]+", TEXT)
],
:multiline_comments => [
(r"/\*", COMMENT_MULTILINE, :__push__),
(r"\*/", COMMENT_MULTILINE, :__pop__),
(r"[^/\*]+", COMMENT_MULTILINE),
],
)
)
greet() = print("Hello World!")
end # module |
@MichaelHatherly Yes, this patch seems to fix the things. |
Yup, fixes it on my side too. |
It'll be out in JuliaRegistries/General#35136 shortly @chengchingwen. |
Thanks! |
Hi, I'm trying to define a Lexer in a local module and during the precompilation I get
LoadError
:The text was updated successfully, but these errors were encountered: