class Bindgen::Graph::Builder

Overview

Builds a graph out of Parser::* structures. Can be used to build a whole namespace out of a Parser::Document, or just for smaller things.

The resulting graph mirrors the structure of the target language.

Defined in:

bindgen/graph/builder.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(db : TypeDatabase) #

[View source]

Instance Method Detail

def build_class(klass : Parser::Class, name : String, root : Graph::Container) : Graph::Class #

Copies klass at path name into the root.


[View source]
def build_document(document : Parser::Document, ns : Namespace) : Namespace #

Copies document into the ns.


[View source]
def build_enum(enumeration : Parser::Enum, name : String, root : Graph::Container) : Graph::Enum #

Copies enumeration at path name into the root.


[View source]
def build_method(method : Parser::Method, parent : Graph::Node | Nil) : Graph::Method #

Copies method into parent.


[View source]
def get_or_create_path(root : Graph::Container, path : Path) : Graph::Node #

Iterates over the path, descending from root onwards. If a part of the path does not exist yet, it'll be created as Namespace.


[View source]
def get_or_create_path_parent(root : Graph::Container, path : Path) : Graph::Container #

Gets the parent of path, starting at root. Makes sure it is a Graph::Container. Also see #get_or_create_path


[View source]
def parent_and_local_name(root : Graph::Container, path_name : String) #

Splits the qualified path, and returns the parent of the target and the name of the path local to the parent.


[View source]
def parent_and_local_name(root : Graph::Container, path : Path) #

ditto


[View source]