Fix code to stick to proper naming convention.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* a string and converting it into
|
||||
* tokens.
|
||||
*/
|
||||
struct lexer {
|
||||
struct libab_lexer_s {
|
||||
/**
|
||||
* The liblex configuration used
|
||||
* to convert the string into tokens.
|
||||
@@ -20,7 +20,7 @@ struct lexer {
|
||||
/**
|
||||
* A token that is produced by the lexer.
|
||||
*/
|
||||
struct lexer_match {
|
||||
struct libab_lexer_match_s {
|
||||
/**
|
||||
* The line that this token was found on.
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ struct lexer_match {
|
||||
* in order to tag meaningful sequences
|
||||
* of characters.
|
||||
*/
|
||||
enum lexer_token {
|
||||
enum libab_lexer_token_e {
|
||||
TOKEN_CHAR = 0,
|
||||
TOKEN_ID,
|
||||
TOKEN_TRUE,
|
||||
@@ -72,9 +72,9 @@ enum lexer_token {
|
||||
TOKEN_LAST
|
||||
};
|
||||
|
||||
typedef struct lexer lexer;
|
||||
typedef enum lexer_token lexer_token;
|
||||
typedef struct lexer_match lexer_match;
|
||||
typedef struct libab_lexer_s libab_lexer;
|
||||
typedef enum libab_lexer_token_e libab_lexer_token;
|
||||
typedef struct libab_lexer_match_s libab_lexer_match;
|
||||
|
||||
/**
|
||||
* Initializes the given lexer,
|
||||
@@ -82,7 +82,7 @@ typedef struct lexer_match lexer_match;
|
||||
* @param lexer the lexer to intiailize.
|
||||
* @return the result of the operation (can be MALLOC on failed allocation.)
|
||||
*/
|
||||
libab_result lexer_init(lexer* lexer);
|
||||
libab_result libab_lexer_init(libab_lexer* lexer);
|
||||
/**
|
||||
* Turns the given input string into tokens.
|
||||
* @param lexer the lexer to use to turn the string into tokens.
|
||||
@@ -90,19 +90,19 @@ libab_result lexer_init(lexer* lexer);
|
||||
* @param lex_into the list which should be populated with matches.
|
||||
* @return the result of the operation.
|
||||
*/
|
||||
libab_result lexer_lex(lexer* lexer, const char* string, ll* lext_into);
|
||||
libab_result libab_lexer_lex(libab_lexer* lexer, const char* string, ll* lext_into);
|
||||
/**
|
||||
* Releases the memory associated with the given lexer,
|
||||
* removing all registered patterns from it.
|
||||
* @param lexer the lexer to free.
|
||||
* @return the result of the operation.
|
||||
*/
|
||||
libab_result lexer_free(lexer* lexer);
|
||||
libab_result libab_lexer_free(libab_lexer* lexer);
|
||||
/**
|
||||
* Function intended to be passed to "foreach" calls
|
||||
* in libds. lexer_lex allocates matches, and passing this function
|
||||
* to foreach will free the memory allocated for the matches.
|
||||
*/
|
||||
int lexer_foreach_match_free(void* data, va_list args);
|
||||
int libab_lexer_foreach_match_free(void* data, va_list args);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* An enum that represents the outcomes of
|
||||
* libabacus functions that can fail.
|
||||
*/
|
||||
enum libab_result {
|
||||
enum libab_result_e {
|
||||
LIBAB_SUCCESS,
|
||||
LIBAB_MALLOC,
|
||||
LIBAB_BAD_PATTERN,
|
||||
@@ -14,6 +14,6 @@ enum libab_result {
|
||||
LIBAB_UNEXPECTED
|
||||
};
|
||||
|
||||
typedef enum libab_result libab_result;
|
||||
typedef enum libab_result_e libab_result;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
* @param to_convert the code to convert.
|
||||
* @return the libabacus equivalent of the error code.
|
||||
*/
|
||||
libab_result convert_lex_result(liblex_result to_convert);
|
||||
libab_result libab_convert_lex_result(liblex_result to_convert);
|
||||
/**
|
||||
* Converts a result code from libds to libabacus.
|
||||
* @param to_convert the code to convert.
|
||||
* @return the libabacus equivalent of the error code.
|
||||
*/
|
||||
libab_result convert_ds_result(libds_result to_convert);
|
||||
libab_result libab_convert_ds_result(libds_result to_convert);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
* @param string the string to use for determining token values.
|
||||
* @param store_into tree pointer to store the new data into.
|
||||
*/
|
||||
libab_result parse_tokens(ll* tokens, const char* string, tree** store_into);
|
||||
libab_result libab_parse_tokens(ll* tokens, const char* string, libab_tree** store_into);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
* as types, functions, and variables in an
|
||||
* environment with scopes.
|
||||
*/
|
||||
struct table {
|
||||
struct libab_table_s {
|
||||
/**
|
||||
* The "parent" scope of this table.
|
||||
*/
|
||||
struct table* parent;
|
||||
struct libab_table_s* parent;
|
||||
/**
|
||||
* The hash table used to store the data.
|
||||
*/
|
||||
@@ -26,7 +26,7 @@ struct table {
|
||||
* Enum that represents the type of a table
|
||||
* entry.
|
||||
*/
|
||||
enum table_entry_variant {
|
||||
enum libab_table_entry_variant_e {
|
||||
ENTRY_VALUE,
|
||||
ENTRY_TYPE,
|
||||
ENTRY_FUNCTION
|
||||
@@ -35,34 +35,34 @@ enum table_entry_variant {
|
||||
/**
|
||||
* An entry in the table.
|
||||
*/
|
||||
struct table_entry {
|
||||
struct libab_table_entry_s {
|
||||
/**
|
||||
* The type of this entry.
|
||||
*/
|
||||
enum table_entry_variant variant;
|
||||
enum libab_table_entry_variant_e variant;
|
||||
};
|
||||
|
||||
typedef struct table table;
|
||||
typedef enum table_entry_variant table_entry_variant;
|
||||
typedef struct table_entry table_entry;
|
||||
typedef struct libab_table_s libab_table;
|
||||
typedef enum libab_table_entry_variant_e libab_table_entry_variant;
|
||||
typedef struct libab_table_entry_s libab_table_entry;
|
||||
|
||||
/**
|
||||
* Initializes the given table.
|
||||
* @param table the table to initialize.
|
||||
*/
|
||||
void table_init(table* table);
|
||||
void libab_table_init(libab_table* table);
|
||||
/**
|
||||
* Searches for the given string in the table.
|
||||
* @param table the table to search.
|
||||
* @param string the string to search for.
|
||||
* @return the table entry, or NULL if an entry was not found.
|
||||
*/
|
||||
table_entry* table_search(table* table, const char* string);
|
||||
libab_table_entry* libab_table_search(libab_table* table, const char* string);
|
||||
/**
|
||||
* Frees the resources allocated by the
|
||||
* given table.
|
||||
* @param table the table to free.
|
||||
*/
|
||||
void table_free(table* table);
|
||||
void libab_table_free(libab_table* table);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/**
|
||||
* Enum to represent the variant of a tree node.
|
||||
*/
|
||||
enum tree_variant {
|
||||
enum libab_tree_variant_e {
|
||||
NONE,
|
||||
BASE,
|
||||
ID,
|
||||
@@ -31,11 +31,11 @@ enum tree_variant {
|
||||
/**
|
||||
* A tree node that has been parsed from the input tokens.
|
||||
*/
|
||||
struct tree {
|
||||
struct libab_tree_s {
|
||||
/**
|
||||
* The variant of tree node.
|
||||
*/
|
||||
enum tree_variant variant;
|
||||
enum libab_tree_variant_e variant;
|
||||
/**
|
||||
* The string value of this tree, if applicable.
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ struct tree {
|
||||
size_t to;
|
||||
};
|
||||
|
||||
typedef enum tree_variant tree_variant;
|
||||
typedef struct tree tree;
|
||||
typedef enum libab_tree_variant_e libab_tree_variant;
|
||||
typedef struct libab_tree_s libab_tree;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user