#include <string.h>
#include <sys/types.h>
#include <yyast/node.h>
#include <yyast/leaf.h>
#include <yyast/count.h>
#include <yyast/utils.h>
Go to the source code of this file.
Defines | |
#define | _GNU_SOURCE |
Functions | |
ya_t | ya_count (char *s, size_t s_length) |
Count characters. | |
uint32_t | ya_get_file_nr (char *filename) |
Get the file number of a filename. | |
void | ya_reposition (char *s, size_t s_length) |
Reposition. | |
ya_t | ya_get_filenames (void) |
Get a list of filenames, as a node that is placed in the header. | |
void | ya_clear_position (ya_t *node) |
Clear the position of a node. | |
Variables | |
ya_position_t | ya_previous_position = {0, 0, 0} |
ya_position_t | ya_current_position = {0, 0, 0} |
char * | ya_filenames [YA_MAX_NR_FILENAMES] |
int | ya_nr_filenames = 0 |
void ya_clear_position | ( | ya_t * | node | ) |
Clear the position of a node.
node | The node to clear the position of. |
Definition at line 146 of file count.c.
References ya_position_s::column, ya_position_s::file, ya_position_s::line, ya_t::node, ya_node_s::position, and ya_t::position.
Referenced by ya_get_filenames(), and ya_header().
ya_t ya_count | ( | char * | s, | |
size_t | s_length | |||
) |
Count characters.
This functions keeps track of byte position, line and column. The byte, line and columns are zero index. This function works with UTF-8.
s | The string to analyze | |
s_length | The length of the string in bytes. |
Definition at line 40 of file count.c.
References ya_position_s::column, ya_position_s::line, ya_t::node, ya_t::position, ya_t::size, ya_t::type, and YA_NODE_TYPE_COUNT.
uint32_t ya_get_file_nr | ( | char * | filename | ) |
Get the file number of a filename.
Adds the filename to the table when it was not found.
filename | Filename to search in the source file list. |
Definition at line 80 of file count.c.
References ya_filenames, YA_MAX_NR_FILENAMES, and ya_nr_filenames.
Referenced by ya_reposition().
ya_t ya_get_filenames | ( | void | ) |
Get a list of filenames, as a node that is placed in the header.
Definition at line 128 of file count.c.
References YA_BRANCH, ya_clear_position(), YA_EMPTYLIST, ya_filenames, YA_LIST, ya_nr_filenames, and ya_text().
Referenced by ya_header().
void ya_reposition | ( | char * | s, | |
size_t | s_length | |||
) |
Reposition.
The given string is a reposition command, it contains the line number of the next line and optionally a filename.
The regex of s must match: [0-9]+\ "([^"]|\")*"
Definition at line 104 of file count.c.
References ya_position_s::column, ya_position_s::file, ya_position_s::line, and ya_get_file_nr().
Referenced by ya_main().
ya_position_t ya_current_position = {0, 0, 0} |
char* ya_filenames[YA_MAX_NR_FILENAMES] |
int ya_nr_filenames = 0 |
ya_position_t ya_previous_position = {0, 0, 0} |