62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
#ifndef __SCC_CORE_H_
|
|
#define __SCC_CORE_H_
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
typedef enum scc_target_language
|
|
{
|
|
c_language,
|
|
csharp,
|
|
} scc_target_language;
|
|
typedef struct scc_options
|
|
{
|
|
scc_target_language target_language;
|
|
char *header_output;
|
|
char *namespace_name;
|
|
char *class_name;
|
|
char *prefix;
|
|
char *data_type_name;
|
|
char *slex_namespace_name;
|
|
char *slex_class_name;
|
|
char *slex_prefix;
|
|
char *slex_data_type_name;
|
|
} scc_options;
|
|
|
|
typedef struct scc_matching
|
|
{
|
|
char **match_ids;
|
|
uint64_t match_id_count;
|
|
char *target_syntax_id;
|
|
char **using_match_id;
|
|
uint64_t using_match_id_count;
|
|
} scc_matching;
|
|
|
|
typedef struct scc_rule
|
|
{
|
|
char *node_type_name;
|
|
scc_matching **matchings;
|
|
uint64_t matching_count;
|
|
} scc_rule;
|
|
typedef struct code_block
|
|
{
|
|
scc_target_language target_languge;
|
|
char *post_processor_code;
|
|
char *variables;
|
|
} code_block;
|
|
|
|
typedef struct scc_rules
|
|
{
|
|
scc_rule *rules;
|
|
uint64_t rule_count;
|
|
char **syntax_ids;
|
|
uint64_t syntax_id_count;
|
|
} scc_rules;
|
|
|
|
bool scc_read_rule_from_file(FILE *f, scc_rules *output_rule);
|
|
bool scc_read_rule_from_cstr(char *content, scc_rules *output_rule);
|
|
|
|
bool scc_translate_to_file_c(scc_options *options, scc_rules *rules, FILE *output_file);
|
|
bool scc_translate_to_file_csharp(scc_options *options, scc_rules *rules, FILE *output_file);
|
|
bool scc_translate_to_file(scc_options *options, scc_rules *rules, FILE *output_file);
|
|
|
|
#endif |