libsapling
0.8.0
|
Lexer implementation hello. More...
#include "libsapling/dm/graph.h"
Go to the source code of this file.
Data Structures | |
struct | lexer_state |
Lexer state object. More... | |
Functions | |
void * | lexer__data (const node_t node) |
void | lexer__access (enum qt qt, node_t *ref, void *info, predicate_t predicate, apply_t apply) |
void | lexer__print (FILE *stream, node_t *ref, fpfdata_t fpfdata) |
void | lexer__dump_dot (FILE *stream, node_t *ref, fpfdata_t fpfdata) |
int | lexer__length (const node_t *ref) |
void | lexer__literal (node_t *dst, const char *expr) |
Build an automaton that accepts a string literal. More... | |
void | lexer__class (node_t *dst, const char *expr) |
Build an automaton that accepts a class of characters. More... | |
void | lexer__anything (node_t *dst) |
Build an automaton that accepts one of any character. More... | |
void | lexer__copy (node_t *dst, node_t *src) |
Build a copy of a given automaton. More... | |
void | lexer__union (node_t *dst, node_t *src) |
void | lexer__concatenation (node_t *dst, node_t *src) |
void | lexer__kleene_star (node_t *dst) |
void | lexer__kleene_plus (node_t *dst) |
void | lexer__minimize (node_t *dst) |
void | lexer__set_accepting_states_data (node_t *ref, void *data) |
Sets the data pointer value of all accepting state of the automaton. More... | |
void | lexer__init (struct lexer_state *ref, const char *buf) |
Initializes a lexer state object. More... | |
void ** | lexer__next_terminal (node_t *ref, struct lexer_state *sta) |
Processes the set character buffer up until it finds the next acceptable lexeme and returns a pointer to the pointer to its data. | |
node_t | lexer__enumerate_states (node_t *ref) |
Returns an AVL map of (node_t, int) More... | |
const char * | lexer__to_string (node_t *ref, node_t *map) |
Prints a lexer automaton in a somewhat-more human readable form. More... | |
Lexer implementation hello.
void lexer__anything | ( | node_t * | dst | ) |
Build an automaton that accepts one of any character.
dst | Where to store the reference to the initial state |
void lexer__class | ( | node_t * | dst, |
const char * | expr | ||
) |
Build an automaton that accepts a class of characters.
dst | Where to store the reference to the initial state |
expr | String literal with the class description, the description consists of opening and closing brackets [] with all the accepted characters within. Furthermore, the description accepts character ranges (e.g. a-z ) and if the dash or minus sign is adjacent to either of the brackets it is considered a character of the class. |
void lexer__concatenation | ( | node_t * | dst, |
node_t * | src | ||
) |
Concatenation of empty graphs is not implemented.
dst | Left hand automaton in which the concatenation of both automata will be written |
src | Right hand automaton which will not be overwritten |
void lexer__copy | ( | node_t * | dst, |
node_t * | src | ||
) |
Build a copy of a given automaton.
dst | Where to store the reference to the initial state |
src | Reference to the initial state of the source automaton |
node_t lexer__enumerate_states | ( | node_t * | ref | ) |
Returns an AVL map of (node_t, int)
This was used in lexer__to_string to print automaton state ids as small numbers instead of their hexadecimal addresses
void lexer__init | ( | struct lexer_state * | ref, |
const char * | buf | ||
) |
Initializes a lexer state object.
ref | Reference to the lexer state object |
buf | Character buffer that will be processed |
void lexer__kleene_plus | ( | node_t * | dst | ) |
Kleene plus of empty graphs is not implemented.
dst | Reference to the automaton to be converted to a kleene plus of itself |
void lexer__kleene_star | ( | node_t * | dst | ) |
Kleene star of empty graphs is not implemented.
dst | Reference to the automaton to be converted to a kleene star of itself |
void lexer__literal | ( | node_t * | dst, |
const char * | expr | ||
) |
Build an automaton that accepts a string literal.
dst | Where to store the reference to the initial state |
expr | String literal surrounded by escaped double quotes (e.g. "\"literal\"" ) |
void lexer__minimize | ( | node_t * | dst | ) |
Minimization of empty graphs is not implemented.
dst | Reference to the automaton to be minimized |
void lexer__set_accepting_states_data | ( | node_t * | ref, |
void * | data | ||
) |
Sets the data pointer value of all accepting state of the automaton.
dst | Reference to the initial state of the automaton |
data | Pointer to the user data that all accepting states will be set to hold |
const char* lexer__to_string | ( | node_t * | ref, |
node_t * | map | ||
) |
Prints a lexer automaton in a somewhat-more human readable form.
void lexer__union | ( | node_t * | dst, |
node_t * | src | ||
) |
dst | First source automaton in which the union of both automata will be written |
src | Second source automaton which will not be overwritten |