Papageno
An Advanced Pattern Matching Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Typedefs | Enumerations | Functions
ppg_token.h File Reference
#include "ppg_action.h"
#include "ppg_action_flags.h"
#include "ppg_settings.h"

Go to the source code of this file.

Macros

#define PPG_TOKENS(...)
 Auxiliary macro to simplify passing tokens to functions such as ppg_pattern. More...
 

Typedefs

typedef void * PPG_Token
 The token type.
 

Enumerations

enum  { PPG_Token_Flags_Pedantic = 1 << 1 }
 Token flags. More...
 

Functions

PPG_Token ppg_token_set_action (PPG_Token token, PPG_Action action)
 Assigns an action to a token. More...
 
PPG_Action ppg_token_get_action (PPG_Token token)
 Returns the action that is associated with a token. More...
 
PPG_Token ppg_token_set_action_flags (PPG_Token token, PPG_Action_Flags_Type action_flags)
 Assigns action flags to a token. More...
 
PPG_Action_Flags_Type ppg_token_get_action_flags (PPG_Token token)
 Returns the action flags associated with a token. More...
 
PPG_Token ppg_token_set_flags (PPG_Token token, PPG_Count flags)
 Assigns flags to a token. More...
 
PPG_Count ppg_token_get_flags (PPG_Token token)
 Returns the flags associated with a token. More...
 
void ppg_token_list_all_active (void)
 Lists all active tokens for debugging purposes.
 

Macro Definition Documentation

#define PPG_TOKENS (   ...)
Value:
sizeof((PPG_Token[]) { __VA_ARGS__ })/sizeof(PPG_Token), \
(PPG_Token[]) { __VA_ARGS__ }
void * PPG_Token
The token type.
Definition: ppg_token.h:38

Auxiliary macro to simplify passing tokens to functions such as ppg_pattern.

Parameters
...The array members

Enumeration Type Documentation

anonymous enum

Token flags.

Enumerator
PPG_Token_Flags_Pedantic 

Enables pedantic mode for tokens.

Function Documentation

PPG_Action ppg_token_get_action ( PPG_Token  token)

Returns the action that is associated with a token.

Parameters
tokenThe token whose action is supposed to be retreived
Returns
The associated action
PPG_Action_Flags_Type ppg_token_get_action_flags ( PPG_Token  token)

Returns the action flags associated with a token.

Parameters
tokenThe token whose action flags are supposed to be retreived
Returns
The current value of the action flags associated with the token.
PPG_Count ppg_token_get_flags ( PPG_Token  token)

Returns the flags associated with a token.

Parameters
tokenThe token whose flags are supposed to be retreived
Returns
The current value of the flags associated with the token.
PPG_Token ppg_token_set_action ( PPG_Token  token,
PPG_Action  action 
)

Assigns an action to a token.

Parameters
tokenThe token to be modified
actionThe action definition to associate with the token
Returns
Returns the value of parameter token to allow for setter-chaining
PPG_Token ppg_token_set_action_flags ( PPG_Token  token,
PPG_Action_Flags_Type  action_flags 
)

Assigns action flags to a token.

To modify the current state of the action flags of a token, use the function ppg_token_get_action_flags, modify its return value by means of applying bit wise operations and pass it to ppg_token_set_action_flags.

Parameters
tokenThe token to be modified
action_flagsThe new value of action flags
Returns
Returns the value of parameter token to allow for setter-chaining
PPG_Token ppg_token_set_flags ( PPG_Token  token,
PPG_Count  flags 
)

Assigns flags to a token.

To modify the current state of the flags of a token, use the function ppg_token_get_flags, modify its return value by means of applying bit wise operations and pass it to ppg_token_set_flags.

Note
Be careful when modifying flags manually as different token types support different types flags. Read the documentation of the respective token type carefully before manipulating its flags.
Parameters
tokenThe token to be modified
flagsThe new value of flags
Returns
Returns the value of parameter token to allow for setter-chaining