mirror of
https://github.com/bigsketti/cshell.git
synced 2025-06-06 21:04:46 +00:00
47 lines
855 B
C
47 lines
855 B
C
// This file exists because I hate myself too much to use cJSON
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
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,
|
|
};
|
|
|
|
struct Token {
|
|
enum TokenType type;
|
|
char value[100];
|
|
};
|
|
|
|
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() {
|
|
|
|
} |