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

Link to this function

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

Link to this function

defmodule_expr(source_file, module)

@spec defmodule_expr(ExCompileGraph.file_path(), atom()) ::
  {:ok, Macro.t()} | {:error, atom()}
Link to this function

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

Link to this function

import_target(expr)

Link to this function

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

Link to this function

require_target(expr)

Link to this function

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

Link to this function

struct_defs!(source_file)

@spec struct_defs!(ExCompileGraph.file_path()) :: [Macro.t()]

Given a source file, return all struct defnitions in that file

Link to this function

struct_expr(source_file, filter_structs)

@spec struct_expr(Macro.t(), [atom()]) :: [{atom(), Macro.t()}]

Find all struct usages in a AST, supports selective filters