Add Node module

This commit is contained in:
Josh Holtrop 2018-04-18 21:16:32 -04:00
parent 866dd42196
commit 89889b778f
2 changed files with 36 additions and 0 deletions

9
src/Node.c Normal file
View File

@ -0,0 +1,9 @@
#include "Node.h"
#include <stdlib.h>
Node * Node_new(int type)
{
Node * node = (Node *)malloc(sizeof(Node));
node->type = type;
return node;
}

27
src/Node.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef NODE_H
#define NODE_H
#include "String.h"
typedef struct
{
int type;
union
{
struct
{
String * fname;
size_t line;
String * text;
} token;
};
} Node;
enum
{
NODE_TYPE_TOKEN,
};
Node * Node_new(int type);
#endif