Add Node module
This commit is contained in:
parent
866dd42196
commit
89889b778f
9
src/Node.c
Normal file
9
src/Node.c
Normal 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
27
src/Node.h
Normal 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
|
Loading…
x
Reference in New Issue
Block a user