Files

56 lines
1.3 KiB
C
Raw Permalink Normal View History

2026-05-26 03:56:30 +10:00
#ifndef __SLEX_CORE_H_
#define __SLEX_CORE_H_
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
typedef enum slex_target_language
{
c_language,
csharp,
} slex_target_language;
typedef struct slex_options
{
slex_target_language target_language;
char *header_output;
char *namespace_name;
char *class_name;
char *prefix;
char *data_type_name;
} slex_options;
typedef struct slex_rule
{
char *Tag;
char *Pattern;
} slex_rule;
typedef struct slex_mapping
{
char *Id;
char *Tag;
} slex_mapping;
typedef struct code_block
{
slex_target_language target_languge;
char *post_processor_code;
char *variables;
} code_block;
typedef struct slex_rules
{
slex_rule *rules;
uint64_t rule_count;
slex_mapping *mappings;
uint64_t mapping_count;
code_block *code_blocks;
uint64_t code_block_count;
} slex_rules;
bool slex_read_rule_from_file(FILE *f, slex_rules *output_rule);
bool slex_read_rule_from_cstr(char *content, slex_rules *output_rule);
bool slex_translate_to_file_c(slex_options *options, slex_rules *rules, FILE *output_file);
bool slex_translate_to_file_csharp(slex_options *options, slex_rules *rules, FILE *output_file);
bool slex_translate_to_file(slex_options *options, slex_rules *rules, FILE *output_file);
#endif