LispBM
Data Structures | Macros | Typedefs | Functions | Variables
tokpar.h File Reference
#include "lbm_types.h"
#include "lbm_channel.h"
Include dependency graph for tokpar.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lbm_tokenizer_string_state_t
 
struct  token_int
 
struct  token_float
 

Macros

#define TOKOPENPAR   1u
 
#define TOKCLOSEPAR   2u
 
#define TOKOPENBRACK   3u
 
#define TOKCLOSEBRACK   4u
 
#define TOKDOT   5u
 
#define TOKDONTCARE   6u
 
#define TOKQUOTE   7u
 
#define TOKBACKQUOTE   8u
 
#define TOKCOMMAAT   9u
 
#define TOKCOMMA   10u
 
#define TOKMATCHANY   11u
 
#define TOKOPENCURL   12u
 
#define TOKCLOSECURL   13u
 
#define TOKCONSTSTART   14u
 
#define TOKCONSTEND   15u
 
#define TOKCONSTSYMSTR   16u
 
#define TOKTYPEBYTE   100u
 
#define TOKTYPEI   101u
 
#define TOKTYPEU   102u
 
#define TOKTYPEI32   103u
 
#define TOKTYPEU32   104u
 
#define TOKTYPEI64   105u
 
#define TOKTYPEU64   106u
 
#define TOKTYPEF32   107u
 
#define TOKTYPEF64   108u
 
#define TOKENIZER_ERROR   1024u
 
#define TOKENIZER_END   2048u
 
#define TOKENIZER_NO_TOKEN   0
 
#define TOKENIZER_NEED_MORE   -1
 
#define TOKENIZER_STRING_ERROR   -2
 
#define TOKENIZER_CHAR_ERROR   -3
 
#define TOKENIZER_MAX_SYMBOL_AND_STRING_LENGTH   256
 

Typedefs

typedef struct token_float token_float
 

Functions

int tok_syntax (lbm_char_channel_t *chan, uint32_t *res)
 
int tok_symbol (lbm_char_channel_t *chan)
 
int tok_string (lbm_char_channel_t *chan, unsigned int *string_len)
 
int tok_char (lbm_char_channel_t *chan, char *res)
 
int tok_double (lbm_char_channel_t *chan, token_float *result)
 
int tok_integer (lbm_char_channel_t *chan, token_int *result)
 
bool tok_clean_whitespace (lbm_char_channel_t *chan)
 

Variables

char tokpar_sym_str [TOKENIZER_MAX_SYMBOL_AND_STRING_LENGTH]
 

Function Documentation

◆ tok_char()

int tok_char ( lbm_char_channel_t chan,
char *  res 
)

Attempt to read a character from the character stream.

Parameters
chanCharacter channel to read characters from.
resResult character if successful.
Returns
A positive value indicating number of characters used if successful. Otherwise a negative status indicator.

◆ tok_clean_whitespace()

bool tok_clean_whitespace ( lbm_char_channel_t chan)

Clean off whitespace from head of the character stream

Returns
True if whitespace could be cleaned. False if stream has no more available characters at the moment.

◆ tok_double()

int tok_double ( lbm_char_channel_t chan,
token_float result 
)

Attempt to read a floating point number from the character stream.

Parameters
chanCharacter channel to read characters from.
resResult token_float-object if successful.
Returns
A positive value indicating number of characters used if successful. Otherwise a negative status indicator.

◆ tok_integer()

int tok_integer ( lbm_char_channel_t chan,
token_int result 
)

Attempt to read an integer value from the character stream.

Parameters
chanCharacter channel to read characters from.
resResult token_int-object if successful.
Returns
A positive value indicating number of characters used if successful. Otherwise a negative status indicator.

◆ tok_string()

int tok_string ( lbm_char_channel_t chan,
unsigned int *  string_len 
)

Attempt to read a string from the character stream. If successful the resulting string is found in tokpar_sym_str.

Parameters
chanCharacter channel to read characters from.
Returns
A positive value indicating number of characters used if successful. Otherwise a negative status indicator.

◆ tok_symbol()

int tok_symbol ( lbm_char_channel_t chan)

Attempt to read a symbol from the character stream. If successful the resulting symbol string is found in tokpar_sym_str.

Parameters
chanCharacter channel to read characters from.
Returns
A positive value indicating number of characters used if successful. Otherwise a negative status indicator.

◆ tok_syntax()

int tok_syntax ( lbm_char_channel_t chan,
uint32_t *  res 
)

Attempt to read a "syntax" token from the character stream. A "syntax" token is for example '(', ')', '@' and so on.

Parameters
chanCharacter channel to read characters from.
resResult token identifier.
Returns
A positive value indicating number of characters used if successful. Otherwise a negative status indicator.