38 lines
934 B
C
38 lines
934 B
C
#ifndef PARSER_H
|
|
#define PARSER_H
|
|
|
|
#include "scirpt/ast.h"
|
|
#include "scirpt/lexer.h"
|
|
#include "scirpt/parser.h"
|
|
#include "scirpt/position.h"
|
|
#include "scirpt/token.h"
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
|
|
struct ScirptParser {
|
|
const char* text;
|
|
size_t text_length;
|
|
ScirptLexer* lexer;
|
|
ScirptToken current;
|
|
ScirptParserErrorArray errors;
|
|
bool ok;
|
|
};
|
|
|
|
void scirpt_parser_construct(
|
|
ScirptParser* parser,
|
|
const char* text,
|
|
size_t text_length,
|
|
ScirptLexer* lexer
|
|
);
|
|
void scirpt_parser_destroy(ScirptParser* parser);
|
|
ScirptAstExpr* scirpt_parser_parse_expr(ScirptParser* parser);
|
|
ScirptAstExpr* scirpt_parser_parse_operand(ScirptParser* parser);
|
|
void scirpt_parser_error(
|
|
ScirptParser* parser, HeapString message, ScirptPosition pos
|
|
);
|
|
void scirpt_parser_step(ScirptParser* parser);
|
|
bool scirpt_parser_current_is(const ScirptParser* parser, ScirptTokenType type);
|
|
bool scirpt_parser_done(const ScirptParser* parser);
|
|
|
|
#endif
|