WONKY



LOG | FILES | OVERVIEW


#ifndef WONKY_AUTOMATA_GENERATOR_H
#define WONKY_AUTOMATA_GENERATOR_H WONKY_AUTOMATA_GENERATOR_H
#include <generator.hh>

#include <stdio.h>
#include <automata.h>
#include <queue.h>
#include <wonky_malloc.h>
#include <wonky_assert.h>
#include <keyword_list.h>


struct Generator_Node
{
	ssize_t node_number;
	const char *data_string;
	const char *kw_string;
	const char *pkw_string;
	const char *action_string;
	struct Automata_Node output;
};


void print_automatas();
void print_automata(struct Generator_Node *root,const char *name,FILE *out);
void print_automata_nodes(struct Generator_Node *node,const char *name,FILE *out);

void print_lexer_type_to_string_map(FILE *out);

struct Generator_Node* make_chonky();
struct Generator_Node* make_generator(const struct Keyword_Entry *keywords,size_t number_of_keywords);
struct Generator_Node* insert_keyword(struct Generator_Node *node,const struct Keyword_Entry *entry);
struct Generator_Node* get_generator_node(const char *data_string,const char *kw_string,const char *pkw_string,const char *action_string);
void add_id_nodes(struct Generator_Node *node);

void add_number_nodes(struct Generator_Node *node);

void add_comment_nodes(struct Generator_Node *node);
struct Generator_Node* get_delta_of(struct Generator_Node *node,enum Source_Chars ch);

/*these return the last generated node so we can add L and LL to them*/
struct Generator_Node* add_decimal_number_nodes(struct Generator_Node *node);
struct Generator_Node* add_hexadecimal_number_nodes(struct Generator_Node *node);
struct Generator_Node* add_octal_number_nodes(struct Generator_Node *node);

void add_integer_suffix(struct Generator_Node *tail,const char *l,const char *ll);

void add_string_char_nodes(struct Generator_Node *node);
void add_string_char_nodes_inner(struct Generator_Node *node,const char *str_kw,const char *char_kw);

void add_finishing_float_nodes(struct Generator_Node *node,_Bool has_read_digits);
void add_finishing_hexadecimal_float_nodes(struct Generator_Node *node,_Bool has_read_digits);
void add_float_suffix(struct Generator_Node *node,const char *f,const char *l);

struct Generator_Node* add_fractional_constant(struct Generator_Node *node,_Bool has_read_digits);
struct Generator_Node* add_hexadecimal_fractional_constant(struct Generator_Node *node,_Bool has_read_digits);

struct Generator_Node* add_exponent_part(struct Generator_Node *node);
struct Generator_Node* add_hexadecimal_exponent_part(struct Generator_Node *node);


void connect_node(struct Generator_Node *node,struct Generator_Node *target_node,struct Queue *node_queue,enum Source_Chars begin,enum Source_Chars end,_Bool push_nodes);

int main();
static const ssize_t NODE_NOT_NUMBERED=-1;

static struct Generator_Node *global_id_node=NULL;

static const char *null_str="NULL";
static const char *no_type_str="KW_NOTYPE";
static const char *id_type_str="KW_ID";

static const char *automata_no_action_str="AUTOMATA_ACTION_NO_ACTION";
static const char *automata_dispense_token_str="AUTOMATA_ACTION_DISPENSE_TOKEN";

#endif