wip: working on classes
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#ifndef FZL_PARSER_H
|
||||
#define FZL_PARSER_H
|
||||
|
||||
#include "common/fzl_types.h"
|
||||
#include <compiler/fzl_reader.h>
|
||||
#include <compiler/fzl_token.h>
|
||||
#include <stddef.h>
|
||||
@@ -16,6 +15,8 @@ typedef enum
|
||||
FZL_NODETYPE_CONDITIONAL,
|
||||
FZL_NODETYPE_FUNCTION,
|
||||
FZL_NODETYPE_RETURN,
|
||||
FZL_NODETYPE_CLASS,
|
||||
FZL_NODETYPE_FIELD,
|
||||
|
||||
FZL_NODETYPE_ADD,
|
||||
FZL_NODETYPE_SUB,
|
||||
@@ -113,6 +114,25 @@ typedef struct fzl_node
|
||||
{
|
||||
struct fzl_node *value;
|
||||
} ret;
|
||||
|
||||
// Class declaration
|
||||
struct
|
||||
{
|
||||
fzl_token_t *name;
|
||||
|
||||
struct fzl_node **fields;
|
||||
size_t fields_count;
|
||||
|
||||
struct fzl_node **methods;
|
||||
size_t methods_count;
|
||||
} class;
|
||||
|
||||
// Member access
|
||||
struct
|
||||
{
|
||||
struct fzl_node *parent;
|
||||
struct fzl_node *field;
|
||||
} memb;
|
||||
};
|
||||
} fzl_node_t;
|
||||
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
// Token type
|
||||
typedef enum
|
||||
{
|
||||
FZL_TOKTYPE_RETURN, // return
|
||||
FZL_TOKTYPE_CLASS, // class
|
||||
FZL_TOKTYPE_NEW, // new
|
||||
|
||||
FZL_TOKTYPE_FUNCTION, // fn
|
||||
FZL_TOKTYPE_RETURN, // return
|
||||
|
||||
FZL_TOKTYPE_IF, // if
|
||||
FZL_TOKTYPE_ELSE, // else
|
||||
|
||||
Reference in New Issue
Block a user