ExCompileGraph.SourceParser (ex_compile_graph v0.1.0)
Find expressions in module by scanning source code AST
Link to this section Summary
Functions
Given a source file and a module, return all invocation of module functions during compile-time in the source file
Returns the lines span in the source file of a given expression
Given a source file and a module contains macro definitions, return all macro expressions in the source file
Given a source file and a module, returns all import expressions originate from that module
Given a source file, return all struct defnitions in that file
Find all struct usages in a AST, supports selective filters
Link to this section Functions
compile_invocation_exprs(source_file, sink_module)
@spec compile_invocation_exprs(ExCompileGraph.file_path(), atom()) :: [Macro.t()]
Given a source file and a module, return all invocation of module functions during compile-time in the source file
defmodule_expr(source_file, module)
@spec defmodule_expr(ExCompileGraph.file_path(), atom()) :: {:ok, Macro.t()} | {:error, atom()}
expr_lines_span(arg)
@spec expr_lines_span(Macro.t()) :: {non_neg_integer(), non_neg_integer()}
Returns the lines span in the source file of a given expression
import_target(expr)
macro_exprs(source_file, macro_module)
@spec macro_exprs(ExCompileGraph.file_path(), atom()) :: [Macro.t()]
Given a source file and a module contains macro definitions, return all macro expressions in the source file
require_target(expr)
scan_module_exprs(source_file, module, expr)
@spec scan_module_exprs(ExCompileGraph.file_path(), atom(), :import | :require) :: [ Macro.t() ]
Given a source file and a module, returns all import expressions originate from that module
struct_defs!(source_file)
@spec struct_defs!(ExCompileGraph.file_path()) :: [Macro.t()]
Given a source file, return all struct defnitions in that file
struct_expr(source_file, filter_structs)
Find all struct usages in a AST, supports selective filters