-
Notifications
You must be signed in to change notification settings - Fork 1
/
Parser.h
30 lines (23 loc) · 965 Bytes
/
Parser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "Lexer.h"
#include "SyntaxNode.h"
#include "StringBuilder.h"
struct Parser
{
Lexer lexer;
Syntax_Location location;
Token_Value value;
int error_count;
String_Builder *error;
bool parsing;
};
typedef void (*Parser_On_Error)(struct Parser *parser);
void parser_register_error_proc(Parser_On_Error proc);
Syntax_Node * parse_subexpression(Parser *parser, uint32_t prec);
Syntax_Node * parse_expression(Parser *parser, uint32_t prec);
Syntax_Node_Expression * parse_root_expression(Parser *parser);
Syntax_Node_Type * parse_type(Parser *parser);
Syntax_Node_Declaration * parse_declaration(Parser *parser);
Syntax_Node_Statement * parse_statement(Parser *parser);
Syntax_Node_Block * parse_block(Parser *parser);
Syntax_Node_Global_Scope *parse_global_scope(Parser *parser);
void parser_init(Parser *parser, String content, String_Builder *error);