Minor update, generating soon enough...
This commit is contained in:
parent
8ff08ce5cf
commit
ef3a428bc9
47
xiranda.c
47
xiranda.c
@ -1,7 +1,6 @@
|
||||
#include <xolatile/xtandard.c>
|
||||
|
||||
enum {
|
||||
coin_none,
|
||||
coin_type, coin_loop, coin_if, coin_else, coin_case, coin_return, coin_import, coin_system,
|
||||
coin_function, coin_variable, coin_constant, coin_data_type, coin_string, coin_number, coin_marker, coin_label,
|
||||
coin_add, coin_subtract, coin_multiply, coin_divide, coin_modulus, coin_equal, coin_above, coin_below,
|
||||
@ -9,8 +8,8 @@ enum {
|
||||
coin_range, coin_enrange, coin_derange, coin_machine
|
||||
};
|
||||
|
||||
static int coin_code = 0;/*
|
||||
static int type_code = 0;
|
||||
static int coin_code = 0;
|
||||
static int type_code = 0;/*
|
||||
static int function_code = 0;
|
||||
static int variable_code = 0;
|
||||
static int constant_code = 0;*/
|
||||
@ -18,10 +17,10 @@ static int constant_code = 0;*/
|
||||
static int coin_enum [240] = { 0 };
|
||||
static int coin_data [240] = { 0 };
|
||||
static char coin_text [240] [40] = { "" };
|
||||
/*
|
||||
|
||||
static char type_name [27] [40] = { "" };
|
||||
static int type_size [27] = { 0 };
|
||||
|
||||
/*
|
||||
static char function_name [9] [40] = { "" };
|
||||
static int function_type [9] = { 0 };
|
||||
static char function_argument_name [9] [6] [40] = { { "" } };
|
||||
@ -49,19 +48,7 @@ static void add_coin (int type, int data, char * text) {
|
||||
string_copy (coin_text [coin_code], text);
|
||||
++coin_code;
|
||||
}
|
||||
/*
|
||||
static void add_type (char * name, int size) {
|
||||
string_copy (type_name [type_code], name);
|
||||
type_size [type_code] = size;
|
||||
++type_code;
|
||||
}
|
||||
|
||||
static void add_function (char * name, int type, char * * agrument_name, int * argument_type) {
|
||||
string_copy (type_name [type_code], name);
|
||||
type_size [type_code] = size;
|
||||
++type_code;
|
||||
}
|
||||
*/
|
||||
int main (void) {
|
||||
char * buffer = null;
|
||||
int offset = 0;
|
||||
@ -79,8 +66,7 @@ int main (void) {
|
||||
data [size] = '\0';
|
||||
add_coin (coin_string, 0, data);
|
||||
} else if (character_is_digit (buffer [offset]) == true) {
|
||||
data [0] = buffer [offset];
|
||||
for (++offset; (character_is_digit (buffer [offset]) == true) && (buffer [offset] != '\0'); ++offset) {
|
||||
for (; (character_is_digit (buffer [offset]) == true) && (buffer [offset] != '\0'); ++offset) {
|
||||
data [size++] = buffer [offset];
|
||||
}
|
||||
add_coin (coin_number, 0, data);
|
||||
@ -100,20 +86,23 @@ int main (void) {
|
||||
}
|
||||
}
|
||||
add_coin (coin_marker, 0, data);
|
||||
/*if ((coin_enum [coin_count - 2] == coin_word) && (coin_data [coin_count - 2] == word_type)) {
|
||||
coin_enum [coin_count - 1] = coin_type;
|
||||
if (coin_enum [coin_code - 2] == coin_type) {
|
||||
coin_enum [coin_code - 1] = coin_data_type;
|
||||
string_copy (type_name [type_code], coin_text [coin_code - 1]);
|
||||
type_size [type_code] = 8;
|
||||
++type_code;
|
||||
}
|
||||
for (length = 0; length < type_code; ++length) {
|
||||
if (string_compare_limit (data, type_name [length], string_length (type_name [length]) + 1) == true) {
|
||||
coin_enum [coin_count - 1] = coin_type;
|
||||
coin_enum [coin_code - 1] = coin_data_type;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
here:
|
||||
--offset;
|
||||
} else if (character_compare_array (buffer [offset], ",.;:=<>#&|!+*-/%()[]") == true) {
|
||||
char s [2] = "";
|
||||
s [0] = buffer [offset];
|
||||
add_coin (coin_none, 0, s);
|
||||
add_coin (coin_range, 0, s);
|
||||
} else {
|
||||
if (character_is_blank (buffer [offset]) == false) {
|
||||
echo ("\033[1;31mCharacter set exception point: Segmentation\033[0m\n");
|
||||
@ -125,9 +114,9 @@ int main (void) {
|
||||
|
||||
for (length = 0; length < coin_code; ++length) {
|
||||
switch (coin_enum [length]) {
|
||||
case coin_string: printf ("\033[1;36m%s\033[0m ", coin_text [length]); break;
|
||||
case coin_string: printf ("\033[1;32m%s\033[0m ", coin_text [length]); break;
|
||||
case coin_number: printf ("\033[1;34m%s\033[0m ", coin_text [length]); break;
|
||||
/*case coin_type: printf ("\033[1;36m%s\033[0m ", coin_text [length]); break;*/
|
||||
case coin_data_type: printf ("\033[1;36m%s\033[0m ", coin_text [length]); break;
|
||||
case coin_marker: printf ("\033[1;37m%s\033[0m ", coin_text [length]); break;
|
||||
case coin_type:
|
||||
case coin_if:
|
||||
@ -144,7 +133,11 @@ int main (void) {
|
||||
|
||||
printf ("\n");
|
||||
/*
|
||||
for (length = 0; length < coin_count; ++length) {
|
||||
for (length = 0; length < coin_code; ++length) {
|
||||
|
||||
}
|
||||
|
||||
for (length = 0; length < coin_code; ++length) {
|
||||
if ((coin_enum [length] == coin_word) && (coin_data [length] == word_return)) {
|
||||
++length;
|
||||
if ((coin_enum [length] == coin_symbol) && (symbol_data [coin_data [length]] == '(')) {
|
||||
|
Loading…
Reference in New Issue
Block a user