Skip to content

Commit

Permalink
generated from Expronicon
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo committed Mar 2, 2024
1 parent da14fb8 commit 0b562f7
Show file tree
Hide file tree
Showing 13 changed files with 3,199 additions and 2,996 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name = "ExproniconLite"
uuid = "55351af7-c7e9-48d6-89ff-24e801d99491"
authors = ["Roger-luo <[email protected]> and contributors"]
version = "0.10.5"
version = "0.10.6"

[deps]

[compat]
Aqua = "0.5"
julia = "1.6"

[extras]
Expand Down
2 changes: 1 addition & 1 deletion src/ExproniconLite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end
end
end
export NoDefault, JLExpr, JLFor, JLIfElse, JLFunction, JLField, JLKwField, JLStruct, JLKwStruct, @expr, @test_expr, compare_expr, AnalysisError, SyntaxError, is_function, is_kw_function, is_struct, is_tuple, is_splat, is_ifelse, is_for, is_field, is_field_default, is_datatype_expr, is_matrix_expr, split_function, split_function_head, split_struct, split_struct_name, split_ifelse, uninferrable_typevars, has_symbol, is_literal, is_gensym, alias_gensym, has_kwfn_constructor, has_plain_constructor, guess_type, guess_module, guess_value, Substitute, no_default, prettify, rm_lineinfo, flatten_blocks, name_only, annotations_only, rm_annotations, rm_single_block, rm_nothing, substitute, eval_interp, eval_literal, renumber_gensym, expr_map, nexprs, codegen_ast, codegen_ast_kwfn, codegen_ast_kwfn_plain, codegen_ast_kwfn_infer, codegen_ast_struct, codegen_ast_struct_head, codegen_ast_struct_body, struct_name_plain, struct_name_without_inferable, xtuple, xnamedtuple, xcall, xpush, xgetindex, xfirst, xlast, xprint, xprintln, xmap, xmapreduce, xiterate, print_inline, print_expr, sprint_expr
export NoDefault, JLExpr, JLFor, JLIfElse, JLFunction, JLField, JLKwField, JLStruct, JLKwStruct, @expr, @test_expr, compare_expr, AnalysisError, SyntaxError, is_function, is_kw_function, is_struct, is_tuple, is_splat, is_ifelse, is_for, is_field, is_field_default, is_datatype_expr, is_matrix_expr, split_function, split_function_head, split_anonymous_function_head, split_struct, split_struct_name, split_ifelse, uninferrable_typevars, has_symbol, is_literal, is_gensym, alias_gensym, has_kwfn_constructor, has_plain_constructor, guess_type, guess_module, guess_value, Substitute, no_default, prettify, rm_lineinfo, flatten_blocks, name_only, annotations_only, rm_annotations, rm_single_block, rm_nothing, substitute, eval_interp, eval_literal, renumber_gensym, expr_map, nexprs, codegen_ast, codegen_ast_kwfn, codegen_ast_kwfn_plain, codegen_ast_kwfn_infer, codegen_ast_struct, codegen_ast_struct_head, codegen_ast_struct_body, struct_name_plain, struct_name_without_inferable, xtuple, xnamedtuple, xcall, xpush, xgetindex, xfirst, xlast, xprint, xprintln, xmap, xmapreduce, xiterate, print_inline, print_expr, sprint_expr
#= none:60 =# @static if !(#= none:60 =# @isdefined(eachsplit))
eachsplit(s, pat) = begin
split(s, pat)
Expand Down
16 changes: 8 additions & 8 deletions src/analysis/check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@
end
var"##return#229" = nothing
var"##231" = def
if var"##231" isa JLFunction
begin
var"##return#229" = let
true
end
$(Expr(:symbolicgoto, Symbol("####final#230#239")))
end
end
if var"##231" isa Expr
if begin
if var"##cache#232" === nothing
Expand Down Expand Up @@ -153,6 +145,14 @@
$(Expr(:symbolicgoto, Symbol("####final#230#239")))
end
end
if var"##231" isa JLFunction
begin
var"##return#229" = let
true
end
$(Expr(:symbolicgoto, Symbol("####final#230#239")))
end
end
begin
var"##return#229" = let
false
Expand Down
250 changes: 125 additions & 125 deletions src/analysis/compare.jl

Large diffs are not rendered by default.

29 changes: 24 additions & 5 deletions src/analysis/cons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,29 @@
var"##return#444"
end
(head, call, body) = split_function(expr; source)
(name, args, kw, whereparams, rettype) = split_function_head(call; source)
(name, args, kw, whereparams, rettype) = let
true
var"##return#468" = nothing
var"##470" = head
if var"##470" == :->
var"##return#468" = let
split_anonymous_function_head(call; source)
end
$(Expr(:symbolicgoto, Symbol("####final#469#471")))
end
begin
var"##return#468" = let h = var"##470"
split_function_head(call; source)
end
$(Expr(:symbolicgoto, Symbol("####final#469#471")))
end
error("matching non-exhaustive, at #= none:30 =#")
$(Expr(:symboliclabel, Symbol("####final#469#471")))
var"##return#468"
end
JLFunction(head, name, args, kw, rettype, generated, whereparams, body, line, doc)
end
#= none:34 =# Core.@doc " JLStruct(ex::Expr)\n\nCreate a `JLStruct` object from a Julia struct `Expr`.\n\n# Example\n\n```julia\njulia> JLStruct(:(struct Foo\n x::Int\n end))\nstruct Foo\n #= REPL[38]:2 =#\n x::Int\nend\n```\n" function JLStruct(ex::Expr; source = nothing)
#= none:37 =# Core.@doc " JLStruct(ex::Expr)\n\nCreate a `JLStruct` object from a Julia struct `Expr`.\n\n# Example\n\n```julia\njulia> JLStruct(:(struct Foo\n x::Int\n end))\nstruct Foo\n #= REPL[38]:2 =#\n x::Int\nend\n```\n" function JLStruct(ex::Expr; source = nothing)
(line, doc, expr) = split_doc(ex)
if !(isnothing(doc))
source = line
Expand All @@ -127,7 +146,7 @@
end
JLStruct(typename, ismutable, typevars, supertype, fields, constructors, line, doc, misc)
end
#= none:81 =# Core.@doc " JLKwStruct(ex::Expr, typealias=nothing)\n\nCreate a `JLKwStruct` from given Julia struct `Expr`, with an option to attach\nan alias to this type name.\n\n# Example\n\n```julia\njulia> JLKwStruct(:(struct Foo\n x::Int = 1\n end))\n#= kw =# struct Foo\n #= REPL[39]:2 =#\n x::Int = 1\nend\n```\n" function JLKwStruct(ex::Expr, typealias = nothing; source = nothing)
#= none:84 =# Core.@doc " JLKwStruct(ex::Expr, typealias=nothing)\n\nCreate a `JLKwStruct` from given Julia struct `Expr`, with an option to attach\nan alias to this type name.\n\n# Example\n\n```julia\njulia> JLKwStruct(:(struct Foo\n x::Int = 1\n end))\n#= kw =# struct Foo\n #= REPL[39]:2 =#\n x::Int = 1\nend\n```\n" function JLKwStruct(ex::Expr, typealias = nothing; source = nothing)
(line, doc, expr) = split_doc(ex)
if !(isnothing(doc))
source = line
Expand All @@ -154,12 +173,12 @@
end
JLKwStruct(typename, typealias, ismutable, typevars, supertype, fields, constructors, line, doc, misc)
end
#= none:128 =# Core.@doc " JLIfElse(ex::Expr)\n\nCreate a `JLIfElse` from given Julia ifelse `Expr`.\n\n# Example\n\n```julia\njulia> ex = :(if foo(x)\n x = 1 + 1\n elseif goo(x)\n y = 1 + 2\n else\n error(\"abc\")\n end)\n:(if foo(x)\n #= REPL[41]:2 =#\n x = 1 + 1\n elseif #= REPL[41]:3 =# goo(x)\n #= REPL[41]:4 =#\n y = 1 + 2\n else\n #= REPL[41]:6 =#\n error(\"abc\")\n end)\n\njulia> JLIfElse(ex)\nif foo(x)\n begin\n #= REPL[41]:2 =# \n x = 1 + 1 \n end\nelseif begin\n #= REPL[41]:3 =# \n goo(x) \nend\n begin\n #= REPL[41]:4 =# \n y = 1 + 2 \n end\nelse\n begin\n #= REPL[41]:6 =# \n error(\"abc\") \n end\nend\n```\n" function JLIfElse(ex::Expr; source = nothing)
#= none:131 =# Core.@doc " JLIfElse(ex::Expr)\n\nCreate a `JLIfElse` from given Julia ifelse `Expr`.\n\n# Example\n\n```julia\njulia> ex = :(if foo(x)\n x = 1 + 1\n elseif goo(x)\n y = 1 + 2\n else\n error(\"abc\")\n end)\n:(if foo(x)\n #= REPL[41]:2 =#\n x = 1 + 1\n elseif #= REPL[41]:3 =# goo(x)\n #= REPL[41]:4 =#\n y = 1 + 2\n else\n #= REPL[41]:6 =#\n error(\"abc\")\n end)\n\njulia> JLIfElse(ex)\nif foo(x)\n begin\n #= REPL[41]:2 =# \n x = 1 + 1 \n end\nelseif begin\n #= REPL[41]:3 =# \n goo(x) \nend\n begin\n #= REPL[41]:4 =# \n y = 1 + 2 \n end\nelse\n begin\n #= REPL[41]:6 =# \n error(\"abc\") \n end\nend\n```\n" function JLIfElse(ex::Expr; source = nothing)
ex.head === :if || throw(SyntaxError("expect an if ... elseif ... else ... end expression", source))
(conds, stmts, otherwise) = split_ifelse(ex)
return JLIfElse(conds, stmts, otherwise)
end
#= none:184 =# Core.@doc " JLFor(ex::Expr)\n\nCreate a `JLFor` from given Julia for loop expression.\n\n# Example\n\n```julia\njulia> ex = @expr for i in 1:10, j in 1:j\n M[i, j] += 1\n end\n:(for i = 1:10, j = 1:j\n #= REPL[3]:2 =#\n M[i, j] += 1\n end)\n\njulia> jl = JLFor(ex)\nfor i in 1 : 10,\n j in 1 : j\n #= loop body =#\n begin\n #= REPL[3]:2 =# \n M[i, j] += 1 \n end\nend\n\njulia> jl.vars\n2-element Vector{Any}:\n :i\n :j\n\njulia> jl.iterators\n2-element Vector{Any}:\n :(1:10)\n :(1:j)\n```\n" function JLFor(ex::Expr)
#= none:187 =# Core.@doc " JLFor(ex::Expr)\n\nCreate a `JLFor` from given Julia for loop expression.\n\n# Example\n\n```julia\njulia> ex = @expr for i in 1:10, j in 1:j\n M[i, j] += 1\n end\n:(for i = 1:10, j = 1:j\n #= REPL[3]:2 =#\n M[i, j] += 1\n end)\n\njulia> jl = JLFor(ex)\nfor i in 1 : 10,\n j in 1 : j\n #= loop body =#\n begin\n #= REPL[3]:2 =# \n M[i, j] += 1 \n end\nend\n\njulia> jl.vars\n2-element Vector{Any}:\n :i\n :j\n\njulia> jl.iterators\n2-element Vector{Any}:\n :(1:10)\n :(1:j)\n```\n" function JLFor(ex::Expr)
(vars, itrs, body) = split_forloop(ex)
return JLFor(vars, itrs, body)
end
Loading

2 comments on commit 0b562f7

@Roger-luo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

release via ion

@JuliaRegistrator register branch=main

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/102122

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.6 -m "<description of version>" 0b562f76adbd29ef12364af0f92c10b7cb468ca9
git push origin v0.10.6

Please sign in to comment.