2021-07-14 08:15:46 -07:00
|
|
|
|
|
|
|
#include "token.h"
|
|
|
|
|
|
|
|
#ifndef LEXER_H
|
|
|
|
#define LEXER_H
|
|
|
|
|
|
|
|
//typedef enum NodeType {
|
|
|
|
// NT_Root,
|
|
|
|
// NT_Header1,
|
|
|
|
// NT_Header2,
|
|
|
|
// NT_Header3,
|
|
|
|
// NT_ListItem,
|
|
|
|
// NT_OrderedListItem,
|
|
|
|
// NT_Paragraph,
|
|
|
|
// NT_PlainText,
|
|
|
|
// NT_BoldText,
|
|
|
|
// NT_UnderlineText,
|
|
|
|
// NT_InlineCode,
|
|
|
|
// NT_BlockCode,
|
|
|
|
//} NodeType;
|
|
|
|
|
|
|
|
typedef struct Lexer {
|
|
|
|
char* rawFile;
|
|
|
|
int rawLen;
|
|
|
|
int position; // current index
|
|
|
|
int readPosition; // next index
|
|
|
|
char ch; // character under examination
|
|
|
|
|
|
|
|
// values for current index
|
|
|
|
int line;
|
|
|
|
int column;
|
|
|
|
|
|
|
|
} Lexer;
|
|
|
|
|
|
|
|
//typedef struct Node {
|
|
|
|
// NodeType type;
|
|
|
|
// char RawText;
|
|
|
|
// int LineNumber;
|
|
|
|
//
|
|
|
|
// //struct Node **ChildNodes;
|
|
|
|
// void** ChildNodes;
|
|
|
|
// int ChildCount;
|
|
|
|
//} Node;
|
|
|
|
|
2023-10-15 15:30:59 -07:00
|
|
|
Lexer* NewLexer(const char* filename);
|
2021-07-14 08:15:46 -07:00
|
|
|
Token* NextToken(Lexer* l);
|
|
|
|
void ReadChar(Lexer* l);
|
|
|
|
void Parse(Lexer* l);
|
|
|
|
|
|
|
|
#endif
|