51 lines
878 B
C
51 lines
878 B
C
|
|
#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;
|
|
|
|
Lexer* NewLexer(char* filename);
|
|
Token* NextToken(Lexer* l);
|
|
void ReadChar(Lexer* l);
|
|
void Parse(Lexer* l);
|
|
|
|
#endif
|