|
@@ -1,6 +1,7 @@
|
|
|
#include "bool.h"
|
|
|
-#include "token.h"
|
|
|
+#include "bitwise.h"
|
|
|
#include "elif.h"
|
|
|
+#include "token.h"
|
|
|
#include <stdio.h>
|
|
|
#include <stdlib.h>
|
|
|
#define MISC 0
|
|
@@ -10,56 +11,12 @@
|
|
|
|
|
|
int cursor_pos = 0;
|
|
|
char *spec = "()[]!&^|<>~%?=+-";
|
|
|
-char *char_line;
|
|
|
-token *token_start = NULL;
|
|
|
-token *token_head = NULL;
|
|
|
-
|
|
|
-int get_str_size(char *str) {
|
|
|
- int size = 0;
|
|
|
- for (char *s = str; *s != '\0'; s++)
|
|
|
- size++;
|
|
|
- return size;
|
|
|
-}
|
|
|
-
|
|
|
-char *get_middle(char *str, int start, int end, BOOL include) {
|
|
|
- int size;
|
|
|
- if (include) size = end - (--start);
|
|
|
- else size = end - start - 1;
|
|
|
- char *str2 = (char *)malloc(sizeof(char) * size+1);
|
|
|
- if (!str2)
|
|
|
- return NULL;
|
|
|
- for (int i = 0; i < size; i++)
|
|
|
- str2[i] = str[start + i];
|
|
|
- str2[size] = 0;
|
|
|
- return str2;
|
|
|
-}
|
|
|
-
|
|
|
-int create_token_from_line(int start, int end, BOOL include, unsigned char type, BOOL is_const) {
|
|
|
- char *str = get_middle(char_line, start, end, include);
|
|
|
- if (!str)
|
|
|
- return 1;
|
|
|
- token *t = (token *)malloc(sizeof(token));
|
|
|
- if (!t) {
|
|
|
- free(str);
|
|
|
- return 2;
|
|
|
- }
|
|
|
- if (is_const) t->value=str;
|
|
|
- if ()
|
|
|
- if (!token_start)
|
|
|
- token_head = t;
|
|
|
- elif (!token_head)
|
|
|
- token_start->chain = token_head = t;
|
|
|
- else {
|
|
|
- token_head->chain = t;
|
|
|
- token_head = t;
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
+char *char_line = NULL;
|
|
|
|
|
|
char get_next_char(BOOL skip_spaces) {
|
|
|
if (skip_spaces) {
|
|
|
- while (char_line[cursor_pos] != 0 & char_line[cursor_pos] <= 32) cursor_pos++; {
|
|
|
- }
|
|
|
+ while (char_line[cursor_pos] != 0 & char_line[cursor_pos] <= 32)
|
|
|
+ cursor_pos++;
|
|
|
}
|
|
|
char buffer = char_line[cursor_pos];
|
|
|
cursor_pos++;
|
|
@@ -79,10 +36,10 @@ int Main(char *line) {
|
|
|
}
|
|
|
elif (mode == STR) {
|
|
|
mode = MISC;
|
|
|
- create_token_from_line(cursor_buffer, cursor_pos, false);
|
|
|
+ // create_token_from_line(cursor_buffer, cursor_pos, false);
|
|
|
}
|
|
|
}
|
|
|
- //elif ('')
|
|
|
+ // elif ('')
|
|
|
}
|
|
|
return 0;
|
|
|
}
|