Archeus 0.0.0
A C library and game engine that focuses on documentation
Loading...
Searching...
No Matches
lexer.h File Reference
#include "arc/std/string.h"
#include <stdint.h>

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...
 

Macros

#define ARC_LEXER_TOKEN_NULL   0
 basic tokens
 
#define ARC_LEXER_TOKEN_NUMBER   1
 
#define ARC_LEXER_TOKEN_ALPHA_LOWER_CHAR   2
 
#define ARC_LEXER_TOKEN_ALPHA_UPPER_CHAR   3
 
#define ARC_LEXER_TOKEN_WHITESPACE   4
 
#define ARC_LEXER_TOKEN_NEWLINE_ID   5
 basic token type ids, chars, and tags
 
#define ARC_LEXER_TOKEN_NEWLINE_CHAR   '\n'
 
#define ARC_LEXER_TOKEN_COLON_ID   6
 
#define ARC_LEXER_TOKEN_COLON_CHAR   ':'
 
#define ARC_LEXER_TOKEN_COLON_TAG   "COLON"
 
#define ARC_LEXER_TOKEN_SEMICOLON_ID   7
 
#define ARC_LEXER_TOKEN_SEMICOLON_CHAR   ';'
 
#define ARC_LEXER_TOKEN_SEMICOLON_TAG   "SEMICOLON"
 
#define ARC_LEXER_TOKEN_COMMA_ID   8
 
#define ARC_LEXER_TOKEN_COMMA_CHAR   ','
 
#define ARC_LEXER_TOKEN_COMMA_TAG   "COMMA"
 
#define ARC_LEXER_TOKEN_PERIOD_ID   9
 
#define ARC_LEXER_TOKEN_PERIOD_CHAR   '.'
 
#define ARC_LEXER_TOKEN_PERIOD_TAG   "PERIOD"
 
#define ARC_LEXER_TOKEN_FORWARD_SLASH_ID   10
 
#define ARC_LEXER_TOKEN_FORWARD_SLASH_CHAR   '/'
 
#define ARC_LEXER_TOKEN_FORWARD_SLASH_TAG   "FORWARD_SLASH"
 
#define ARC_LEXER_TOKEN_BACK_SLASH_ID   11
 
#define ARC_LEXER_TOKEN_BACK_SLASH_CHAR   '\\'
 
#define ARC_LEXER_TOKEN_BACK_SLASH_TAG   "BACK_SLASH"
 
#define ARC_LEXER_TOKEN_LEFT_PARENTHESIS_ID   12
 
#define ARC_LEXER_TOKEN_LEFT_PARENTHESIS_CHAR   '('
 
#define ARC_LEXER_TOKEN_LEFT_PARENTHESIS_TAG   "LEFT_PARENTHESIS"
 
#define ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_ID   13
 
#define ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_CHAR   ')'
 
#define ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_TAG   "RIGHT_PARENTHESIS"
 
#define ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_ID   14
 
#define ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_CHAR   '{'
 
#define ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_TAG   "LEFT_CURLY_BRACE"
 
#define ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_ID   15
 
#define ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_CHAR   '}'
 
#define ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_TAG   "RIGHT_CURLY_BRACE"
 
#define ARC_LEXER_TOKEN_BANG_ID   16
 
#define ARC_LEXER_TOKEN_BANG_CHAR   '!'
 
#define ARC_LEXER_TOKEN_BANG_TAG   "BANG"
 
#define ARC_LEXER_TOKEN_AT_ID   17
 
#define ARC_LEXER_TOKEN_AT_CHAR   '!'
 
#define ARC_LEXER_TOKEN_AT_TAG   "AT"
 
#define ARC_LEXER_TOKEN_HASH_ID   18
 
#define ARC_LEXER_TOKEN_HASH_CHAR   '#'
 
#define ARC_LEXER_TOKEN_HASH_TAG   "HASH"
 
#define ARC_LEXER_TOKEN_PERCENT_ID   19
 
#define ARC_LEXER_TOKEN_PERCENT_CHAR   '%'
 
#define ARC_LEXER_TOKEN_PERCENT_TAG   "PERCENT"
 

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_LexerTokenARC_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)
 

Macro Definition Documentation

◆ ARC_LEXER_TOKEN_ALPHA_LOWER_CHAR

#define ARC_LEXER_TOKEN_ALPHA_LOWER_CHAR   2

Definition at line 250 of file lexer.h.

◆ ARC_LEXER_TOKEN_ALPHA_UPPER_CHAR

#define ARC_LEXER_TOKEN_ALPHA_UPPER_CHAR   3

Definition at line 251 of file lexer.h.

◆ ARC_LEXER_TOKEN_AT_CHAR

#define ARC_LEXER_TOKEN_AT_CHAR   '!'

Definition at line 293 of file lexer.h.

◆ ARC_LEXER_TOKEN_AT_ID

#define ARC_LEXER_TOKEN_AT_ID   17

Definition at line 292 of file lexer.h.

◆ ARC_LEXER_TOKEN_AT_TAG

#define ARC_LEXER_TOKEN_AT_TAG   "AT"

Definition at line 294 of file lexer.h.

◆ ARC_LEXER_TOKEN_BACK_SLASH_CHAR

#define ARC_LEXER_TOKEN_BACK_SLASH_CHAR   '\\'

Definition at line 275 of file lexer.h.

◆ ARC_LEXER_TOKEN_BACK_SLASH_ID

#define ARC_LEXER_TOKEN_BACK_SLASH_ID   11

Definition at line 274 of file lexer.h.

◆ ARC_LEXER_TOKEN_BACK_SLASH_TAG

#define ARC_LEXER_TOKEN_BACK_SLASH_TAG   "BACK_SLASH"

Definition at line 276 of file lexer.h.

◆ ARC_LEXER_TOKEN_BANG_CHAR

#define ARC_LEXER_TOKEN_BANG_CHAR   '!'

Definition at line 290 of file lexer.h.

◆ ARC_LEXER_TOKEN_BANG_ID

#define ARC_LEXER_TOKEN_BANG_ID   16

Definition at line 289 of file lexer.h.

◆ ARC_LEXER_TOKEN_BANG_TAG

#define ARC_LEXER_TOKEN_BANG_TAG   "BANG"

Definition at line 291 of file lexer.h.

◆ ARC_LEXER_TOKEN_COLON_CHAR

#define ARC_LEXER_TOKEN_COLON_CHAR   ':'

Definition at line 260 of file lexer.h.

◆ ARC_LEXER_TOKEN_COLON_ID

#define ARC_LEXER_TOKEN_COLON_ID   6

Definition at line 259 of file lexer.h.

◆ ARC_LEXER_TOKEN_COLON_TAG

#define ARC_LEXER_TOKEN_COLON_TAG   "COLON"

Definition at line 261 of file lexer.h.

◆ ARC_LEXER_TOKEN_COMMA_CHAR

#define ARC_LEXER_TOKEN_COMMA_CHAR   ','

Definition at line 266 of file lexer.h.

◆ ARC_LEXER_TOKEN_COMMA_ID

#define ARC_LEXER_TOKEN_COMMA_ID   8

Definition at line 265 of file lexer.h.

◆ ARC_LEXER_TOKEN_COMMA_TAG

#define ARC_LEXER_TOKEN_COMMA_TAG   "COMMA"

Definition at line 267 of file lexer.h.

◆ ARC_LEXER_TOKEN_FORWARD_SLASH_CHAR

#define ARC_LEXER_TOKEN_FORWARD_SLASH_CHAR   '/'

Definition at line 272 of file lexer.h.

◆ ARC_LEXER_TOKEN_FORWARD_SLASH_ID

#define ARC_LEXER_TOKEN_FORWARD_SLASH_ID   10

Definition at line 271 of file lexer.h.

◆ ARC_LEXER_TOKEN_FORWARD_SLASH_TAG

#define ARC_LEXER_TOKEN_FORWARD_SLASH_TAG   "FORWARD_SLASH"

Definition at line 273 of file lexer.h.

◆ ARC_LEXER_TOKEN_HASH_CHAR

#define ARC_LEXER_TOKEN_HASH_CHAR   '#'

Definition at line 296 of file lexer.h.

◆ ARC_LEXER_TOKEN_HASH_ID

#define ARC_LEXER_TOKEN_HASH_ID   18

Definition at line 295 of file lexer.h.

◆ ARC_LEXER_TOKEN_HASH_TAG

#define ARC_LEXER_TOKEN_HASH_TAG   "HASH"

Definition at line 297 of file lexer.h.

◆ ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_CHAR

#define ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_CHAR   '{'

Definition at line 284 of file lexer.h.

◆ ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_ID

#define ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_ID   14

Definition at line 283 of file lexer.h.

◆ ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_TAG

#define ARC_LEXER_TOKEN_LEFT_CURLY_BRACE_TAG   "LEFT_CURLY_BRACE"

Definition at line 285 of file lexer.h.

◆ ARC_LEXER_TOKEN_LEFT_PARENTHESIS_CHAR

#define ARC_LEXER_TOKEN_LEFT_PARENTHESIS_CHAR   '('

Definition at line 278 of file lexer.h.

◆ ARC_LEXER_TOKEN_LEFT_PARENTHESIS_ID

#define ARC_LEXER_TOKEN_LEFT_PARENTHESIS_ID   12

Definition at line 277 of file lexer.h.

◆ ARC_LEXER_TOKEN_LEFT_PARENTHESIS_TAG

#define ARC_LEXER_TOKEN_LEFT_PARENTHESIS_TAG   "LEFT_PARENTHESIS"

Definition at line 279 of file lexer.h.

◆ ARC_LEXER_TOKEN_NEWLINE_CHAR

#define ARC_LEXER_TOKEN_NEWLINE_CHAR   '\n'

Definition at line 258 of file lexer.h.

◆ ARC_LEXER_TOKEN_NEWLINE_ID

#define ARC_LEXER_TOKEN_NEWLINE_ID   5

basic token type ids, chars, and tags

Definition at line 257 of file lexer.h.

◆ ARC_LEXER_TOKEN_NULL

#define ARC_LEXER_TOKEN_NULL   0

basic tokens

Definition at line 248 of file lexer.h.

◆ ARC_LEXER_TOKEN_NUMBER

#define ARC_LEXER_TOKEN_NUMBER   1

Definition at line 249 of file lexer.h.

◆ ARC_LEXER_TOKEN_PERCENT_CHAR

#define ARC_LEXER_TOKEN_PERCENT_CHAR   '%'

Definition at line 299 of file lexer.h.

◆ ARC_LEXER_TOKEN_PERCENT_ID

#define ARC_LEXER_TOKEN_PERCENT_ID   19

Definition at line 298 of file lexer.h.

◆ ARC_LEXER_TOKEN_PERCENT_TAG

#define ARC_LEXER_TOKEN_PERCENT_TAG   "PERCENT"

Definition at line 300 of file lexer.h.

◆ ARC_LEXER_TOKEN_PERIOD_CHAR

#define ARC_LEXER_TOKEN_PERIOD_CHAR   '.'

Definition at line 269 of file lexer.h.

◆ ARC_LEXER_TOKEN_PERIOD_ID

#define ARC_LEXER_TOKEN_PERIOD_ID   9

Definition at line 268 of file lexer.h.

◆ ARC_LEXER_TOKEN_PERIOD_TAG

#define ARC_LEXER_TOKEN_PERIOD_TAG   "PERIOD"

Definition at line 270 of file lexer.h.

◆ ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_CHAR

#define ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_CHAR   '}'

Definition at line 287 of file lexer.h.

◆ ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_ID

#define ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_ID   15

Definition at line 286 of file lexer.h.

◆ ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_TAG

#define ARC_LEXER_TOKEN_RIGHT_CURLY_BRACE_TAG   "RIGHT_CURLY_BRACE"

Definition at line 288 of file lexer.h.

◆ ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_CHAR

#define ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_CHAR   ')'

Definition at line 281 of file lexer.h.

◆ ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_ID

#define ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_ID   13

Definition at line 280 of file lexer.h.

◆ ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_TAG

#define ARC_LEXER_TOKEN_RIGHT_PARENTHESIS_TAG   "RIGHT_PARENTHESIS"

Definition at line 282 of file lexer.h.

◆ ARC_LEXER_TOKEN_SEMICOLON_CHAR

#define ARC_LEXER_TOKEN_SEMICOLON_CHAR   ';'

Definition at line 263 of file lexer.h.

◆ ARC_LEXER_TOKEN_SEMICOLON_ID

#define ARC_LEXER_TOKEN_SEMICOLON_ID   7

Definition at line 262 of file lexer.h.

◆ ARC_LEXER_TOKEN_SEMICOLON_TAG

#define ARC_LEXER_TOKEN_SEMICOLON_TAG   "SEMICOLON"

Definition at line 264 of file lexer.h.

◆ ARC_LEXER_TOKEN_WHITESPACE

#define ARC_LEXER_TOKEN_WHITESPACE   4

Definition at line 252 of file lexer.h.

Typedef Documentation

◆ ARC_Lexer

typedef struct ARC_Lexer ARC_Lexer

a lexer type

Definition at line 13 of file lexer.h.

◆ ARC_LexerToken

typedef struct ARC_LexerToken ARC_LexerToken

a lexer token type

◆ ARC_LexerTokenRule

typedef struct ARC_LexerTokenRule ARC_LexerTokenRule

a lexer token rule type

◆ ARC_LexerTokenRule_AutomataFn

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

Note
do not set tokenData if this function returns 0, doing so will create a memory leak
Parameters
[out]tokenDataa place to store token data (like a variable name), can be NULL if not needed
[in]stringa string to be checked to see if it matches a token
[in]automataDataany data that needs to be used for the ARC_Lexer_AutomataFn
Returns
the size of the token found, or 0 if the token was not found

Definition at line 34 of file lexer.h.

◆ ARC_LexerTokenRule_DestroyAutomataDataFn

typedef void(* ARC_LexerTokenRule_DestroyAutomataDataFn) (void *automataData)

a callback function to clean up ARC_LexerTokenRule's automataData

Parameters
automataDatathe void * automataData to destroy

Definition at line 41 of file lexer.h.

Function Documentation

◆ ARC_Lexer_AutomataMatchCharFn()

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

Note
this is intended as a helper callback
this function is a ARC_Lexer_AutomataFn callback
Parameters
[out]tokenDataa place to store token data (like a variable name), can be NULL if not needed
[in]stringa string to be checked to see if it matches a token
[in]automataDataany data that needs to be used for the ARC_Lexer_AutomataFn
Returns
the size of the token found, or 0 if the token was not found

◆ ARC_Lexer_AutomataMatchCharInStringFn()

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

Note
this is intended as a helper callback
this function is a ARC_Lexer_AutomataFn callback
Parameters
[out]tokenDataa place to store token data (like a variable name), can be NULL if not needed
[in]stringa string to be checked to see if it matches a token
[in]automataDataany data that needs to be used for the ARC_Lexer_AutomataFn
Returns
the size of the token found, or 0 if the token was not found

◆ ARC_Lexer_AutomataMatchStringFn()

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

Note
this is intended as a helper callback
this function is a ARC_Lexer_AutomataFn callback
Parameters
[out]tokenDataa place to store token data (like a variable name), can be NULL if not needed
[in]stringa string to be checked to see if it matches a token
[in]automataDataany data that needs to be used for the ARC_Lexer_AutomataFn
Returns
the size of the token found, or 0 if the token was not found

◆ ARC_Lexer_Clear()

void ARC_Lexer_Clear ( ARC_Lexer * lexer)

clears all tokens from a lexer (will not clear token rules)

Parameters
lexerthe lexer to clear tokens from

◆ ARC_Lexer_Create()

void ARC_Lexer_Create ( ARC_Lexer ** lexer)

creates an ARC_Lexer type

Parameters
[out]lexerARC_Lexer to create

◆ ARC_Lexer_Destroy()

void ARC_Lexer_Destroy ( ARC_Lexer * lexer)

destroys an ARC_Lexer type

Parameters
[in]lexerARC_Lexer to free

◆ ARC_Lexer_GetToken()

ARC_LexerToken * ARC_Lexer_GetToken ( ARC_Lexer * lexer,
uint32_t index )

gets a token at a given index from a lexer

Note
unless you have a very good reason, you probably don't want to mess with the tokens string. that will probably change the token's string inside the lexer
Parameters
[in]lexerthe lexer to get the token from
[in]indexthe index of the token in the lexer to get
Returns
a token at the lexer index on success, otherwise NULL

◆ ARC_Lexer_GetTokensSize()

uint32_t ARC_Lexer_GetTokensSize ( ARC_Lexer * lexer)

gets a token at a given index from a lexer

Parameters
[in]lexerthe lexer to get the tokens size from
Returns
the size of the token array in a lexer

◆ ARC_Lexer_InitBasicTokenRules()

void ARC_Lexer_InitBasicTokenRules ( ARC_Lexer * lexer)

adds a bunch of basic token rules (matching the BasicTokens above)

◆ ARC_Lexer_IsContinious()

ARC_Bool ARC_Lexer_IsContinious ( ARC_Lexer * lexer)

returns a boolean based on if a lexers rules are continious

Parameters
[in]lexerthe lexer to check if its ruls are continious
Returns
ARC_True if the set rules are continious

◆ ARC_Lexer_IsTokenId()

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

Parameters
[in]lexerthe lexer to check stored token rule ids
[in]idthe id to check against the token rules
Returns
ARC_True if the id is a rule id, ARC_False otherwise

◆ ARC_Lexer_LexFile()

void ARC_Lexer_LexFile ( ARC_Lexer * lexer,
ARC_String * path )

reads in and lexs a file

Note
this function will call ARC_Lexer_LexString, so it's notes are applicable to this function
Parameters
[in]lexerthe lexer which holds to rules to use
[in]pathpath of file to read in and lex

◆ ARC_Lexer_LexString()

void ARC_Lexer_LexString ( ARC_Lexer * lexer,
ARC_String ** data )

creates tokens using a given string with ARC_LexerToken rules

Parameters
[in]lexerthe 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

◆ ARC_Lexer_PrintTokenRules()

void ARC_Lexer_PrintTokenRules ( ARC_Lexer * lexer)

prints rule id and hex of the function name

Note
this is mostly used for debugging
Parameters
[in]lexerthe lexer to print rules from

◆ ARC_Lexer_RegisterTokenRule()

void ARC_Lexer_RegisterTokenRule ( ARC_Lexer * lexer,
ARC_LexerTokenRule tokenRule )

adds a token rule to a lexer

Parameters
[in]lexerthe lexer to add a token rule to
[in]tokenRulethe token rule to add

◆ ARC_LexerTokenRule_CreateAndReturnMatchCharInStringRule()

ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchCharInStringRule ( uint32_t id,
ARC_String * string )

creates a ARC_LexerTokenRule with a given id and string

Note
this is intended as a helper funtion #note string will not be freed (it will be copied and the copy will be freed)
Parameters
[in]ida tokens id (basically the token value)
[in]characterthe string to match against, will be copied
Returns
a token rule based in the id and string

◆ ARC_LexerTokenRule_CreateAndReturnMatchCharOrBetween()

ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchCharOrBetween ( uint32_t id,
char start,
char end )

creates a ARC_LexerTokenRule with a given id and character range

Note
this is intended as a helper funtion
Parameters
[in]ida tokens id (basically the token value)
[in]startthe minimum character value to match against
[in]endthe maxamum character value to match against
Returns
a token rule based in the id and character

◆ ARC_LexerTokenRule_CreateAndReturnMatchCharRule()

ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchCharRule ( uint32_t id,
char character )

creates a ARC_LexerTokenRule with a given id and character

Note
this is intended as a helper funtion
Parameters
[in]ida tokens id (basically the token value)
[in]characterthe character to match against
Returns
a token rule based in the id and character

◆ ARC_LexerTokenRule_CreateAndReturnMatchStringRule()

ARC_LexerTokenRule ARC_LexerTokenRule_CreateAndReturnMatchStringRule ( uint32_t id,
ARC_String * string )

creates a ARC_LexerTokenRule with a given id and string

Note
this is intended as a helper funtion #note string will not be freed (it will be copied and the copy will be freed)
Parameters
[in]ida tokens id (basically the token value)
[in]characterthe string to match against, will be copied
Returns
a token rule based in the id and string