fcml
1.2.2
|
Structures and functions declarations related to FCML parsers. More...
#include "fcml_lib_export.h"
#include "fcml_types.h"
#include "fcml_errors.h"
#include "fcml_common.h"
#include "fcml_dialect.h"
#include "fcml_symbols.h"
Go to the source code of this file.
Classes | |
struct | fcml_st_parser_config |
Parser configuration. More... | |
struct | fcml_st_parser_context |
Parser runtime context. More... | |
struct | fcml_st_parser_result |
Reusable result holder. More... | |
Macros | |
#define | FCML_PARSER_MAX_INSTRUCTION_LEN 1024 |
Maximal number of character for parsed instruction. More... | |
Typedefs | |
typedef struct fcml_st_parser_config | fcml_st_parser_config |
Parser configuration. More... | |
typedef struct fcml_st_parser_context | fcml_st_parser_context |
Parser runtime context. More... | |
typedef struct fcml_st_parser_result | fcml_st_parser_result |
Reusable result holder. | |
Functions | |
LIB_EXPORT fcml_ceh_error LIB_CALL | fcml_fn_parse (fcml_st_parser_context *context, const fcml_string instruction, fcml_st_parser_result *result) |
Parses given instruction into the generic instruction model. More... | |
LIB_EXPORT void LIB_CALL | fcml_fn_parser_result_prepare (fcml_st_parser_result *result) |
Prepares reusable result holder for parser. More... | |
LIB_EXPORT void LIB_CALL | fcml_fn_parser_result_free (fcml_st_parser_result *result) |
Cleans result holder. More... | |
Structures and functions declarations related to FCML parsers.
#define FCML_PARSER_MAX_INSTRUCTION_LEN 1024 |
Maximal number of character for parsed instruction.
typedef struct fcml_st_parser_config fcml_st_parser_config |
Parser configuration.
typedef struct fcml_st_parser_context fcml_st_parser_context |
Parser runtime context.
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_parse | ( | fcml_st_parser_context * | context, |
const fcml_string | instruction, | ||
fcml_st_parser_result * | result | ||
) |
Parses given instruction into the generic instruction model.
Parses the textual representation of the instruction using dialect and configuration provided by the parser context. Parsed instruction is returned in the reusable result holder. Result holder has to be allocated by the user and appropriately prepared using fcml_fn_parser_result_prepare() function. As long as the instruction context and the result holder are not shared across multiple function calls parsing process is thread safe.
Remember that textual representation of the instruction has to be written using syntax supported by the dialect parser is going to use.
context | Parser runtime context. |
instruction | textual representation of the instruction to be parsed. |
result | Reusable result holder. |
LIB_EXPORT void LIB_CALL fcml_fn_parser_result_free | ( | fcml_st_parser_result * | result | ) |
Cleans result holder.
Frees all memory blocks allocated by the parser and held inside the result holder (Instructions, errors etc.). Notice that result holder itself is not freed and can be even safety reused after call to this function. In fact this function is also called internally by the parser in order to clean result holder before reusing it.
result | Result holder to clean. |
LIB_EXPORT void LIB_CALL fcml_fn_parser_result_prepare | ( | fcml_st_parser_result * | result | ) |
Prepares reusable result holder for parser.
Every instance of fcml_st_parser_result structure is reusable from the parser's point of view, so it has to be prepared in the right way in order to allow parser to reuse it correctly. It is up to the library user to allocate space for the holder itself. This function is only responsible for cleaning the structure correctly and preparing it for the first parsing process. Notice that parser has to clean the result holder at the beginning so you can not pass an uninitialized memory block because it can even cause a crash due to illegal memory access.
result | Result holder instance to be prepared. |