-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Expand file tree
/
Copy pathflfrontend.jl
More file actions
33 lines (29 loc) · 1.42 KB
/
Copy pathflfrontend.jl
File metadata and controls
33 lines (29 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# This file is a part of Julia. License is MIT: https://julialang.org/license
# Call Julia's builtin flisp-based parser. `offset` is 0-based offset into the
# byte buffer or string. `version` may be nothing during bootstrap.
function fl_parse(text::Union{Core.SimpleVector,String},
filename::String, lineno, offset, options, version)
if version !== nothing && Base.thisminor(version) != Base.thisminor(VERSION)
error("Syntax version $version not supported by flisp parser ($VERSION)")
end
if text isa Core.SimpleVector
# Will be generated by C entry points jl_parse etc
text, text_len = text
else
text_len = sizeof(text)
end
ccall(:jl_fl_parse, Any, (Ptr{UInt8}, Csize_t, Any, Csize_t, Csize_t, Any),
text, text_len, filename, lineno, offset, options)
end
function fl_parse(text::AbstractString, filename::AbstractString, lineno,
offset, options, version)
fl_parse(String(text), String(filename), lineno, offset, options, version)
end
function fl_parse_bootstrap(text, filename, lineno, offset, options)
fl_parse(text, filename, lineno, offset, options, nothing)
end
function fl_lower(ex, mod::Module, filename::String="none",
lineno::Int=0, world::UInt=typemax(Csize_t), warn::Bool=false)
ccall(:jl_fl_lower, Any, (Any, Any, Ptr{UInt8}, Cint, Csize_t, Cint),
ex, mod, filename, lineno, world, warn)
end