jsfw/ser/parser.h
viandoxdev eec4668856
ser
2023-05-06 18:42:50 +02:00

36 lines
636 B
C

#ifndef PARSER_H
#define PARSER_H
#include "ast.h"
#include "lexer.h"
#include "source.h"
#include "vector.h"
#include "vector_impl.h"
typedef union {
TokenType type;
} ParsingErrorData;
typedef enum {
ParsingErrorNoError,
ParsingErrorUnexpectedToken,
} ParsingErrorType;
typedef struct {
Span span;
ParsingErrorType type;
ParsingErrorData data;
} ParsingError;
VECTOR_IMPL(ParsingError, ParsingErrorVec, parsing_error);
typedef struct {
AstContext ctx;
ParsingErrorVec errors;
} ParsingResult;
ParsingResult parse(TokenVec vec);
void parsing_error_report(Source *src, ParsingError *err);
#endif