Experimenting with tokenizing strings. This commit just focuses on splitting strings up by whitespace.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#ifndef TOKENIZER_H
|
||||
#define TOKENIZER_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "list.h"
|
||||
|
||||
typedef enum {
|
||||
TK_Add,
|
||||
TK_Sub,
|
||||
TK_Mul,
|
||||
TK_Div,
|
||||
TK_Power,
|
||||
TK_LParam,
|
||||
TK_RParam,
|
||||
TK_Comma,
|
||||
TK_LBracket,
|
||||
TK_RBracket,
|
||||
TK_Colon,
|
||||
TK_Text,
|
||||
TK_Number,
|
||||
TK_Invalid
|
||||
} TokenType;
|
||||
|
||||
typedef struct {
|
||||
TokenType type;
|
||||
char* value;
|
||||
} Token;
|
||||
|
||||
List* TokenizeString(const char *);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user