|
| static infix_type * | parse_type (parser_state *state) |
| |
| static infix_status | parse_function_signature_details (parser_state *state, infix_type **out_ret_type, infix_function_argument **out_args, size_t *out_num_args, size_t *out_num_fixed_args) |
| |
| static void | set_parser_error (parser_state *state, infix_error_code_t code) |
| |
| static void | skip_whitespace (parser_state *state) |
| |
| static bool | parse_size_t (parser_state *state, size_t *out_val) |
| |
| static const char * | parse_identifier (parser_state *state) |
| |
| static bool | consume_keyword (parser_state *state, const char *keyword) |
| |
| static const char * | parse_optional_name_prefix (parser_state *state) |
| |
| static bool | is_function_signature_ahead (const parser_state *state) |
| |
| static infix_struct_member * | parse_aggregate_members (parser_state *state, char end_char, size_t *out_num_members) |
| |
| static infix_type * | parse_aggregate (parser_state *state, char start_char, char end_char) |
| |
| static infix_type * | parse_packed_struct (parser_state *state) |
| |
| static infix_type * | parse_primitive (parser_state *state) |
| |
| c23_nodiscard infix_status | _infix_parse_type_internal (infix_type **out_type, infix_arena_t **out_arena, const char *signature) |
| | The internal core of the signature parser.
|
| |
| c23_nodiscard infix_status | infix_type_from_signature (infix_type **out_type, infix_arena_t **out_arena, const char *signature, infix_registry_t *registry) |
| | Parses a signature string representing a single data type.
|
| |
| c23_nodiscard infix_status | infix_signature_parse (const char *signature, infix_arena_t **out_arena, infix_type **out_ret_type, infix_function_argument **out_args, size_t *out_num_args, size_t *out_num_fixed_args, infix_registry_t *registry) |
| | Parses a full function signature string into its constituent parts.
|
| |
| static void | _print (printer_state *state, const char *fmt,...) |
| |
| static void | _infix_type_print_signature_recursive (printer_state *state, const infix_type *type) |
| |
| static void | _infix_type_print_body_only_recursive (printer_state *state, const infix_type *type) |
| |
| c23_nodiscard infix_status | _infix_type_print_body_only (char *buffer, size_t buffer_size, const infix_type *type, infix_print_dialect_t dialect) |
| | An internal-only function to serialize a type's body without its registered name.
|
| |
| c23_nodiscard infix_status | infix_type_print (char *buffer, size_t buffer_size, const infix_type *type, infix_print_dialect_t dialect) |
| | Serializes an infix_type object graph back into a signature string.
|
| |
| c23_nodiscard infix_status | infix_function_print (char *buffer, size_t buffer_size, const char *function_name, const infix_type *ret_type, const infix_function_argument *args, size_t num_args, size_t num_fixed_args, infix_print_dialect_t dialect) |
| | Serializes a function signature's components into a string.
|
| |
| c23_nodiscard infix_status | infix_registry_print (char *buffer, size_t buffer_size, const infix_registry_t *registry) |
| | Serializes all defined types within a registry into a single, human-readable string.
|
| |
Implements the infix signature string parser and type printer.
Copyright (c) 2025 Sanko Robinson
This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.
SPDX-License-Identifier: (Artistic-2.0 OR MIT)
The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
SPDX-License-Identifier: CC-BY-4.0
This module is responsible for two key functionalities that form the user-facing API of the library:
- Parsing: It contains a hand-written recursive descent parser that transforms a human-readable signature string (e.g.,
"({int, *char}) -> void") into an unresolved infix_type object graph. This is the **"Parse"** stage of the core data pipeline. The internal entry point for this stage is _infix_parse_type_internal.
- Printing: It provides functions to serialize a fully resolved
infix_type graph back into a canonical signature string. This is crucial for introspection, debugging, and verifying the library's understanding of a type.
The public functions infix_type_from_signature and infix_signature_parse are high-level orchestrators. They manage the entire **"Parse -> Copy -> Resolve -> Layout"** pipeline, providing the user with a fully validated, self-contained, and ready-to-use type object that is safe to use for the lifetime of its returned arena.