Kestrel Interface
Loading...
Searching...
No Matches
kest_eff_parser.c File Reference
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include "kest_int.h"

Go to the source code of this file.

Macros

#define PRINTLINES_ALLOWED   1
#define KEST_PARSER_PRINT_BUFLEN   1024
#define KEST_PARSER_PRINT_LOC_BUFLEN   128
#define PR_LINE_INDENT   4

Functions

int kest_eff_parser_init_mempool ()
int kest_eff_parser_reset_mempool ()
int kest_eff_parser_deinit_mempool ()
void * kest_parser_alloc (size_t size)
char * kest_parser_strndup (const char *str, int n)
int kest_parse_tokens (kest_eff_parsing_state *ps)
int init_parsing_state (kest_eff_parsing_state *ps)
int kest_parser_lineize_content (kest_eff_parsing_state *ps)
int kest_parser_compute_formats (kest_eff_parsing_state *ps)
kest_effect_desckest_read_eff_desc_from_file (char *fname)
int kest_parser_format_offending_section (char *line, int index, int length, char *buf, int buf_len, char *colour)
void kest_parser_print_info_at (kest_eff_parsing_state *ps, kest_token_ll *token, const char *msg,...)
void kest_parser_warn_at (kest_eff_parsing_state *ps, kest_token_ll *token, const char *msg,...)
void kest_parser_error_at (kest_eff_parsing_state *ps, kest_token_ll *token, const char *msg,...)
void kest_parser_print_info_at_line (kest_eff_parsing_state *ps, int line, const char *msg,...)
void kest_parser_warn_at_line (kest_eff_parsing_state *ps, int line, const char *msg,...)
void kest_parser_error_at_line (kest_eff_parsing_state *ps, int line, const char *msg,...)
void kest_parser_print_info_at_node (kest_eff_parsing_state *ps, kest_ast_node *node, const char *msg,...)
void kest_parser_warn_at_node (kest_eff_parsing_state *ps, kest_ast_node *node, const char *msg,...)
void kest_parser_error_at_node (kest_eff_parsing_state *ps, kest_ast_node *node, const char *msg,...)
void kest_parser_print_info (kest_eff_parsing_state *ps, const char *msg,...)
void kest_parser_warn (kest_eff_parsing_state *ps, const char *msg,...)
void kest_parser_error (kest_eff_parsing_state *ps, const char *msg,...)

Variables

const char * ver_str = "v1.0"
kest_bump_arena kest_eff_parser_mempool
int kest_parser_mempool_initialised = 0
kest_allocatorkest_parser_allocator = NULL
const char * err_colour = "\e[01;31m"
const char * info_colour = "\e[01;36m"
const char * warn_colour = "\e[01;32m"
const char * reset_colour = "\e[0m"

Macro Definition Documentation

◆ KEST_PARSER_PRINT_BUFLEN

◆ KEST_PARSER_PRINT_LOC_BUFLEN

◆ PR_LINE_INDENT

#define PR_LINE_INDENT   4

Definition at line 589 of file kest_eff_parser.c.

Referenced by kest_parser_format_offending_section().

◆ PRINTLINES_ALLOWED

#define PRINTLINES_ALLOWED   1

Definition at line 9 of file kest_eff_parser.c.

Function Documentation

◆ init_parsing_state()

int init_parsing_state ( kest_eff_parsing_state * ps)

Definition at line 357 of file kest_eff_parser.c.

Referenced by kest_read_eff_desc_from_file().

Here is the caller graph for this function:

◆ kest_eff_parser_deinit_mempool()

int kest_eff_parser_deinit_mempool ( )

Definition at line 42 of file kest_eff_parser.c.

Referenced by load_effects().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_eff_parser_init_mempool()

int kest_eff_parser_init_mempool ( )

Definition at line 21 of file kest_eff_parser.c.

Referenced by kest_read_eff_desc_from_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_eff_parser_reset_mempool()

int kest_eff_parser_reset_mempool ( )

Definition at line 32 of file kest_eff_parser.c.

Referenced by load_effects().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_parse_tokens()

int kest_parse_tokens ( kest_eff_parsing_state * ps)

Definition at line 66 of file kest_eff_parser.c.

Referenced by kest_read_eff_desc_from_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_parser_alloc()

void * kest_parser_alloc ( size_t size)

Definition at line 48 of file kest_eff_parser.c.

Referenced by kest_dictionary_bucket_ensure_capacity(), kest_dictionary_ensure_capacity(), kest_new_dictionary(), kest_parse_asm_line(), kest_parse_dict_list(), kest_parse_tokens(), kest_parser_lineize_content(), kest_parser_strndup(), kest_read_eff_desc_from_file(), and kest_token_ll_safe_aappend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_parser_compute_formats()

int kest_parser_compute_formats ( kest_eff_parsing_state * ps)

Definition at line 428 of file kest_eff_parser.c.

Referenced by kest_read_eff_desc_from_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_parser_error()

void kest_parser_error ( kest_eff_parsing_state * ps,
const char * msg,
... )

Definition at line 887 of file kest_eff_parser.c.

Referenced by kest_parse_dictionary(), kest_parse_tokens(), and kest_read_eff_desc_from_file().

Here is the caller graph for this function:

◆ kest_parser_error_at()

void kest_parser_error_at ( kest_eff_parsing_state * ps,
kest_token_ll * token,
const char * msg,
... )

Definition at line 699 of file kest_eff_parser.c.

Referenced by kest_parse_asm_arg(), kest_parse_asm_arg_2(), kest_parse_asm_line(), kest_parse_dict_val(), kest_parse_dictionary(), kest_parse_expression_rec_pratt(), and kest_parse_tokens().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_parser_error_at_line()

void kest_parser_error_at_line ( kest_eff_parsing_state * ps,
int line,
const char * msg,
... )

Definition at line 771 of file kest_eff_parser.c.

Referenced by kest_defs_section_extract(), kest_process_asm_line(), and kest_tokenize_content().

Here is the caller graph for this function:

◆ kest_parser_error_at_node()

void kest_parser_error_at_node ( kest_eff_parsing_state * ps,
kest_ast_node * node,
const char * msg,
... )

◆ kest_parser_format_offending_section()

int kest_parser_format_offending_section ( char * line,
int index,
int length,
char * buf,
int buf_len,
char * colour )

Definition at line 591 of file kest_eff_parser.c.

Referenced by kest_parser_error_at(), kest_parser_print_info_at(), and kest_parser_warn_at().

Here is the caller graph for this function:

◆ kest_parser_lineize_content()

int kest_parser_lineize_content ( kest_eff_parsing_state * ps)

Definition at line 382 of file kest_eff_parser.c.

Referenced by kest_read_eff_desc_from_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_parser_print_info()

void kest_parser_print_info ( kest_eff_parsing_state * ps,
const char * msg,
... )

Definition at line 849 of file kest_eff_parser.c.

◆ kest_parser_print_info_at()

void kest_parser_print_info_at ( kest_eff_parsing_state * ps,
kest_token_ll * token,
const char * msg,
... )

Definition at line 643 of file kest_eff_parser.c.

Here is the call graph for this function:

◆ kest_parser_print_info_at_line()

void kest_parser_print_info_at_line ( kest_eff_parsing_state * ps,
int line,
const char * msg,
... )

Definition at line 733 of file kest_eff_parser.c.

◆ kest_parser_print_info_at_node()

void kest_parser_print_info_at_node ( kest_eff_parsing_state * ps,
kest_ast_node * node,
const char * msg,
... )

Definition at line 791 of file kest_eff_parser.c.

◆ kest_parser_strndup()

char * kest_parser_strndup ( const char * str,
int n )

Definition at line 53 of file kest_eff_parser.c.

Referenced by kest_parse_asm_line(), kest_parse_dict_val(), kest_parse_dictionary(), kest_parse_tokens(), kest_read_eff_desc_from_file(), and kest_tokenize_content().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kest_parser_warn()

void kest_parser_warn ( kest_eff_parsing_state * ps,
const char * msg,
... )

Definition at line 868 of file kest_eff_parser.c.

◆ kest_parser_warn_at()

void kest_parser_warn_at ( kest_eff_parsing_state * ps,
kest_token_ll * token,
const char * msg,
... )

Definition at line 671 of file kest_eff_parser.c.

Here is the call graph for this function:

◆ kest_parser_warn_at_line()

void kest_parser_warn_at_line ( kest_eff_parsing_state * ps,
int line,
const char * msg,
... )

Definition at line 752 of file kest_eff_parser.c.

◆ kest_parser_warn_at_node()

void kest_parser_warn_at_node ( kest_eff_parsing_state * ps,
kest_ast_node * node,
const char * msg,
... )

Definition at line 810 of file kest_eff_parser.c.

Referenced by kest_extract_bool_setting_from_dict(), kest_extract_int_setting_from_dict(), kest_extract_parameter_from_dict(), and kest_extract_setting_from_dict().

Here is the caller graph for this function:

◆ kest_read_eff_desc_from_file()

kest_effect_desc * kest_read_eff_desc_from_file ( char * fname)

Definition at line 456 of file kest_eff_parser.c.

Referenced by load_effects().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ err_colour

const char* err_colour = "\e[01;31m"

◆ info_colour

const char* info_colour = "\e[01;36m"

Definition at line 585 of file kest_eff_parser.c.

Referenced by kest_parser_print_info_at().

◆ kest_eff_parser_mempool

◆ kest_parser_allocator

kest_allocator* kest_parser_allocator = NULL

Definition at line 19 of file kest_eff_parser.c.

Referenced by kest_eff_parser_init_mempool(), and kest_parse_dict_list().

◆ kest_parser_mempool_initialised

int kest_parser_mempool_initialised = 0

◆ reset_colour

const char* reset_colour = "\e[0m"

◆ ver_str

const char* ver_str = "v1.0"

Definition at line 14 of file kest_eff_parser.c.

Referenced by kest_tokenize_content().

◆ warn_colour

const char* warn_colour = "\e[01;32m"

Definition at line 586 of file kest_eff_parser.c.

Referenced by kest_parser_warn_at().