|
Archeus 0.0.0
A C library and game engine that focuses on documentation
|
Go to the source code of this file.
Data Structures | |
| struct | ARC_LexerToken |
| a lexer token type More... | |
| struct | ARC_LexerTokenRule |
| a lexer token rule type More... | |
Typedefs | |
| typedef struct ARC_Lexer | ARC_Lexer |
| a lexer type | |
| typedef struct ARC_LexerToken | ARC_LexerToken |
| a lexer token type | |
| typedef uint32_t(* | ARC_LexerTokenRule_AutomataFn) (ARC_String **tokenData, ARC_String *string, void *automataData) |
| checks to see if a string is a type of token | |
| typedef void(* | ARC_LexerTokenRule_DestroyAutomataDataFn) (void *automataData) |
| a callback function to clean up ARC_LexerTokenRule's automataData | |
| typedef struct ARC_LexerTokenRule | ARC_LexerTokenRule |
| a lexer token rule type | |
Functions | |
| void | ARC_Lexer_Create (ARC_Lexer **lexer) |
| creates an ARC_Lexer type | |
| void | ARC_Lexer_Destroy (ARC_Lexer *lexer) |
| destroys an ARC_Lexer type | |
| void | ARC_Lexer_RegisterTokenRule (ARC_Lexer *lexer, ARC_LexerTokenRule tokenRule) |
| adds a token rule to a lexer | |
| void | ARC_Lexer_Clear (ARC_Lexer *lexer) |
| clears all tokens from a lexer (will not clear token rules) | |
| void | ARC_Lexer_LexString (ARC_Lexer *lexer, ARC_String **data) |
| creates tokens using a given string with ARC_LexerToken rules | |
| void | ARC_Lexer_LexFile (ARC_Lexer *lexer, ARC_String *path) |
| reads in and lexs a file | |
| void | ARC_Lexer_PrintTokenRules (ARC_Lexer *lexer) |
| prints rule id and hex of the function name | |
| ARC_LexerToken * | ARC_Lexer_GetToken (ARC_Lexer *lexer, uint32_t index) |
| gets a token at a given index from a lexer | |
| uint32_t | ARC_Lexer_GetTokensSize (ARC_Lexer *lexer) |
| gets a token at a given index from a lexer | |
| ARC_Bool | ARC_Lexer_IsContinious (ARC_Lexer *lexer) |
| returns a boolean based on if a lexers rules are continious | |
| ARC_Bool | ARC_Lexer_IsTokenId (ARC_Lexer *lexer, uint32_t id) |
| returns a boolean based on if a given id is a stored token rule id | |
| uint32_t | ARC_Lexer_AutomataMatchCharFn (ARC_String **tokenData, ARC_String *string, void *automataData) |
| checks if the first character of string matches the automataData cast as a char | |
| uint32_t | ARC_Lexer_AutomataMatchStringFn (ARC_String **tokenData, ARC_String *string, void *automataData) |
| checks if the substring automataData as an ARC_String matches the first part of string | |
| uint32_t | ARC_Lexer_AutomataMatchCharInStringFn (ARC_String **tokenData, ARC_String *string, void *automataData) |
| checks if the first part of string is a character in substring | |
| ARC_LexerTokenRule | ARC_LexerTokenRule_CreateAndReturnMatchCharRule (uint32_t id, char character) |
| creates a ARC_LexerTokenRule with a given id and character | |
| ARC_LexerTokenRule | ARC_LexerTokenRule_CreateAndReturnMatchCharOrBetween (uint32_t id, char start, char end) |
| creates a ARC_LexerTokenRule with a given id and character range | |
| ARC_LexerTokenRule | ARC_LexerTokenRule_CreateAndReturnMatchStringRule (uint32_t id, ARC_String *string) |
| creates a ARC_LexerTokenRule with a given id and string | |
| ARC_LexerTokenRule | ARC_LexerTokenRule_CreateAndReturnMatchCharInStringRule (uint32_t id, ARC_String *string) |
| creates a ARC_LexerTokenRule with a given id and string | |
| void | ARC_Lexer_InitBasicTokenRules (ARC_Lexer *lexer) |
| adds a bunch of basic token rules (matching the BasicTokens above) | |
| #define ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_TAG "LEFT_CURLY_BRACE" |
| #define ARC_LEXER_TOKEN_LEFT_PARENTHESIS_TAG "LEFT_PARENTHESIS" |
| #define ARC_LEXER_TOKEN_NEWLINE_ID 5 |
| #define ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_TAG "RIGHT_CURLY_BRACE" |
| #define ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_TAG "RIGHT_PARENTHESIS" |
| typedef struct ARC_LexerToken ARC_LexerToken |
a lexer token type
| typedef struct ARC_LexerTokenRule ARC_LexerTokenRule |
a lexer token rule type
| typedef uint32_t(* ARC_LexerTokenRule_AutomataFn) (ARC_String **tokenData, ARC_String *string, void *automataData) |
checks to see if a string is a type of token
| [out] | tokenData | a place to store token data (like a variable name), can be NULL if not needed |
| [in] | string | a string to be checked to see if it matches a token |
| [in] | automataData | any data that needs to be used for the ARC_Lexer_AutomataFn |
| typedef void(* ARC_LexerTokenRule_DestroyAutomataDataFn) (void *automataData) |
a callback function to clean up ARC_LexerTokenRule's automataData
| automataData | the void * automataData to destroy |
| uint32_t ARC_Lexer_AutomataMatchCharFn | ( | ARC_String ** | tokenData, |
| ARC_String * | string, | ||
| void * | automataData ) |
checks if the first character of string matches the automataData cast as a char
| [out] | tokenData | a place to store token data (like a variable name), can be NULL if not needed |
| [in] | string | a string to be checked to see if it matches a token |
| [in] | automataData | any data that needs to be used for the ARC_Lexer_AutomataFn |
| uint32_t ARC_Lexer_AutomataMatchCharInStringFn | ( | ARC_String ** | tokenData, |
| ARC_String * | string, | ||
| void * | automataData ) |
checks if the first part of string is a character in substring
| [out] | tokenData | a place to store token data (like a variable name), can be NULL if not needed |
| [in] | string | a string to be checked to see if it matches a token |
| [in] | automataData | any data that needs to be used for the ARC_Lexer_AutomataFn |
| uint32_t ARC_Lexer_AutomataMatchStringFn | ( | ARC_String ** | tokenData, |
| ARC_String * | string, | ||
| void * | automataData ) |
checks if the substring automataData as an ARC_String matches the first part of string
| [out] | tokenData | a place to store token data (like a variable name), can be NULL if not needed |
| [in] | string | a string to be checked to see if it matches a token |
| [in] | automataData | any data that needs to be used for the ARC_Lexer_AutomataFn |
| void ARC_Lexer_Clear | ( | ARC_Lexer * | lexer | ) |
clears all tokens from a lexer (will not clear token rules)
| lexer | the lexer to clear tokens from |
| void ARC_Lexer_Create | ( | ARC_Lexer ** | lexer | ) |
creates an ARC_Lexer type
| [out] | lexer | ARC_Lexer to create |
| void ARC_Lexer_Destroy | ( | ARC_Lexer * | lexer | ) |
destroys an ARC_Lexer type
| [in] | lexer | ARC_Lexer to free |
| ARC_LexerToken * ARC_Lexer_GetToken | ( | ARC_Lexer * | lexer, |
| uint32_t | index ) |
gets a token at a given index from a lexer
| [in] | lexer | the lexer to get the token from |
| [in] | index | the index of the token in the lexer to get |
| uint32_t ARC_Lexer_GetTokensSize | ( | ARC_Lexer * | lexer | ) |
gets a token at a given index from a lexer
| [in] | lexer | the lexer to get the tokens size from |
| void ARC_Lexer_InitBasicTokenRules | ( | ARC_Lexer * | lexer | ) |
adds a bunch of basic token rules (matching the BasicTokens above)
returns a boolean based on if a lexers rules are continious
| [in] | lexer | the lexer to check if its ruls are continious |
returns a boolean based on if a given id is a stored token rule id
| [in] | lexer | the lexer to check stored token rule ids |
| [in] | id | the id to check against the token rules |
| void ARC_Lexer_LexFile | ( | ARC_Lexer * | lexer, |
| ARC_String * | path ) |
reads in and lexs a file
| [in] | lexer | the lexer which holds to rules to use |
| [in] | path | path of file to read in and lex |
| void ARC_Lexer_LexString | ( | ARC_Lexer * | lexer, |
| ARC_String ** | data ) |
creates tokens using a given string with ARC_LexerToken rules
| [in] | lexer | the lexer to get the ARC_LexerTokens from |
| [in/out] | data the string to lex, will be freed and set to NULL by the end of this function |
| void ARC_Lexer_PrintTokenRules | ( | ARC_Lexer * | lexer | ) |
prints rule id and hex of the function name
| [in] | lexer | the lexer to print rules from |
| void ARC_Lexer_RegisterTokenRule | ( | ARC_Lexer * | lexer, |
| ARC_LexerTokenRule | tokenRule ) |
adds a token rule to a lexer
| [in] | lexer | the lexer to add a token rule to |
| [in] | tokenRule | the token rule to add |
| ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchCharInStringRule | ( | uint32_t | id, |
| ARC_String * | string ) |
creates a ARC_LexerTokenRule with a given id and string
| [in] | id | a tokens id (basically the token value) |
| [in] | character | the string to match against, will be copied |
| ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchCharOrBetween | ( | uint32_t | id, |
| char | start, | ||
| char | end ) |
creates a ARC_LexerTokenRule with a given id and character range
| [in] | id | a tokens id (basically the token value) |
| [in] | start | the minimum character value to match against |
| [in] | end | the maxamum character value to match against |
| ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchCharRule | ( | uint32_t | id, |
| char | character ) |
creates a ARC_LexerTokenRule with a given id and character
| [in] | id | a tokens id (basically the token value) |
| [in] | character | the character to match against |
| ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchStringRule | ( | uint32_t | id, |
| ARC_String * | string ) |
creates a ARC_LexerTokenRule with a given id and string
| [in] | id | a tokens id (basically the token value) |
| [in] | character | the string to match against, will be copied |