mirror of
https://github.com/bigsketti/cshell.git
synced 2025-06-07 05:14:47 +00:00
49 lines
992 B
C
49 lines
992 B
C
// This file exists because I hate myself too much to use cJSON
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef enum TokenType {
|
|
INTEGER,
|
|
CHAR,
|
|
TRUE,
|
|
FALSE,
|
|
IDENTIFIER,
|
|
VALUE,
|
|
COLON,
|
|
R_CURLY_BRACE,
|
|
L_CURLY_BRACE,
|
|
R_BRACKET,
|
|
L_BRACKET,
|
|
DOUBLE_QUOTES,
|
|
COMMA,
|
|
END_OF_FILE,
|
|
} Token_type;
|
|
|
|
typedef struct Token {
|
|
enum TokenType type;
|
|
char value[100];
|
|
} Token;
|
|
|
|
void advancePosition(int *pos, char *currentChar, char *input[]) {
|
|
if(pos < sizeof(input)) {
|
|
currentChar = input[*pos];
|
|
printf("Advancing to %s at position %s", currentChar, *pos);
|
|
} else {
|
|
currentChar = "\0";
|
|
printf("End of Input");
|
|
}
|
|
}
|
|
|
|
void skipWhiteSpace(int *pos, char currentChar) {
|
|
if (currentChar != "\0" && is_space(currentChar) == true) {
|
|
pos++;
|
|
}
|
|
}
|
|
|
|
void tokenizeJSON() {
|
|
// TODO: finish this after token type functions
|
|
}
|
|
|
|
// TODO: make functions to handle types of tokens
|