View Source Unifex.CodeGenerator.Utils (Unifex v1.2.1)
Utilities for code generation.
Summary
Functions
Traverses Elixir specification AST and creates C data types serialization
with serializers
.
Replaces special characters such as: .
, ->
and array brackets e.g. var_name[i]
with underscores.
Sigil used for templating generated code.
Functions
@spec generate_enums_definitions( config :: Enumerable.t(), generator :: (term(), map() -> Unifex.CodeGenerator.code_t()), ctx :: map() ) :: Unifex.CodeGenerator.code_t()
@spec generate_functions( config :: Enumerable.t(), generator :: (term(), map() -> Unifex.CodeGenerator.code_t()), ctx :: map() ) :: Unifex.CodeGenerator.code_t()
@spec generate_functions_declarations( config :: Enumerable.t(), generator :: (term(), map() -> Unifex.CodeGenerator.code_t()), ctx :: map() ) :: Unifex.CodeGenerator.code_t()
@spec generate_serialization( ast :: Macro.t(), serializers :: %{ arg_serializer: (type :: Unifex.CodeGenerator.BaseType.t(), name :: atom() -> output), tuple_serializer: ([output] -> output) } ) :: {output, label: atom(), arg: {name :: atom(), type :: Unifex.CodeGenerator.BaseType.t()}} when output: term()
Traverses Elixir specification AST and creates C data types serialization
with serializers
.
@spec generate_structs_definitions( config :: Enumerable.t(), generator :: (term(), map() -> Unifex.CodeGenerator.code_t()), ctx :: map() ) :: Unifex.CodeGenerator.code_t()
Replaces special characters such as: .
, ->
and array brackets e.g. var_name[i]
with underscores.
In case of arrays var_name[i]
results in var_name_i
.
Sigil used for templating generated code.