|
json-gen-c
0.1.5
json-gen-c generate C code for json manipulation
|
parse struct definition file. More...
#include "struct/struct_parse.h"#include <ctype.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "utils/diag.h"#include "utils/compat.h"#include "utils/hash_map.h"#include "utils/io.h"#include "utils/sstr.h"#include "utils/error_codes.h"
Classes | |
| struct | validate_ctx |
Macros | |
| #define | PERROR(parser, fmt, ...) |
Enumerations | |
| enum | top_level_item_kind { TOP_LEVEL_ITEM_INVALID = 0 , TOP_LEVEL_ITEM_INCLUDE , TOP_LEVEL_ITEM_STRUCT , TOP_LEVEL_ITEM_ENUM , TOP_LEVEL_ITEM_ONEOF } |
Functions | |
| struct struct_parser * | struct_parser_new () |
| create and init a struct_parser instance. | |
| void | struct_parser_free (struct struct_parser *parser) |
| free a struct_parser instance. | |
| int | struct_parser_parse (struct struct_parser *parser, sstr_t content) |
| parse a struct definition file, and store the parsed structs in struct_parser. | |
| int | struct_parser_validate_to (struct struct_parser *parser, FILE *out) |
| Validate parsed schema and optionally print diagnostics. | |
| int | struct_parser_validate (struct struct_parser *parser) |
| Validate parsed schema for semantic errors. | |
parse struct definition file.
| #define PERROR | ( | parser, | |
| fmt, | |||
| ... | |||
| ) |
| void struct_parser_free | ( | struct struct_parser * | parser | ) |
free a struct_parser instance.
| parser | struct struct_parser* |
| struct struct_parser * struct_parser_new | ( | ) |
create and init a struct_parser instance.
| int struct_parser_parse | ( | struct struct_parser * | parser, |
| sstr_t | content | ||
| ) |
parse a struct definition file, and store the parsed structs in struct_parser.
| parser | context of parser. |
| content | content of the file. |
| int struct_parser_validate | ( | struct struct_parser * | parser | ) |
Validate parsed schema for semantic errors.
Checks for: undefined type references, duplicate field names, duplicate enum values, and C keyword usage.
| parser | Parser with populated struct_map and enum_map. |
| int struct_parser_validate_to | ( | struct struct_parser * | parser, |
| FILE * | out | ||
| ) |
Validate parsed schema and optionally print diagnostics.
| parser | Parser with populated struct_map, enum_map, and oneof_map. |
| out | Destination stream for diagnostics, or NULL to suppress printing. |