2021-07-14 08:15:46 -07:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "token.h"
|
|
|
|
|
|
|
|
#ifndef NODE_H
|
|
|
|
#define NODE_H
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
NT_Header1,
|
|
|
|
NT_Header2,
|
|
|
|
NT_Header3,
|
|
|
|
NT_Header4,
|
|
|
|
NT_Paragraph,
|
|
|
|
NT_UnorderedList,
|
|
|
|
NT_OrderedList,
|
|
|
|
NT_InlineCode,
|
|
|
|
NT_BlockCode,
|
|
|
|
NT_BlockQuote,
|
|
|
|
NT_Bold,
|
|
|
|
NT_Underline,
|
|
|
|
} NodeType;
|
|
|
|
|
|
|
|
struct NodeList;
|
|
|
|
|
|
|
|
typedef struct Node {
|
|
|
|
NodeType type;
|
2023-10-15 15:30:59 -07:00
|
|
|
struct Node* next;
|
|
|
|
/*struct NodeList* children;*/
|
2021-07-14 08:15:46 -07:00
|
|
|
} Node;
|
|
|
|
|
|
|
|
typedef struct NodeList {
|
2023-10-15 15:30:59 -07:00
|
|
|
struct Node* first;
|
|
|
|
/*struct Node* node;
|
|
|
|
struct Node* next;*/
|
2021-07-14 08:15:46 -07:00
|
|
|
} NodeList;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
NodeType type;
|
|
|
|
struct Node* next;
|
|
|
|
char* rawText;
|
|
|
|
} HeaderNode;
|
|
|
|
|
2023-10-15 15:30:59 -07:00
|
|
|
/*
|
|
|
|
typedef struct {
|
|
|
|
NodeType type;
|
|
|
|
struct Node* next;
|
|
|
|
} ParagraphNode;
|
|
|
|
*/
|
|
|
|
|
2021-07-14 08:15:46 -07:00
|
|
|
NodeList* ParseNodes(TokenList* list);
|
2023-10-15 15:30:59 -07:00
|
|
|
char* NodeTypeString(NodeType t);
|
2021-07-14 08:15:46 -07:00
|
|
|
|
|
|
|
#endif
|