/*
 * This file is part of Beastie <https://purl.org/nxg/dist/beastie>
 * SPDX-FileCopyrightText: 2023 Norman Gray <https://nxg.me.uk>
 * SPDX-License-Identifier: BSD-2-Clause
 */

#ifndef PARSE_BST_H
#define PARSE_BST_H 1

#include <stdio.h>              // for FILE
#include "beastie.h"            // for YYSTYPE and s7_pointer
#include "yycommon.h"           // for YYLTYPE

struct bst_extra_s {
    void* yyscanbuf;            // cast from YY_BUFFER_STATE
    char* path;                 // source file
    FILE* f;
};
typedef struct bst_extra_s* bst_extra_t;

// defined in parse-bst.lex
yyscan_t parse_bst_setup_file(bst_extra_t, const char* path);
yyscan_t parse_bst_setup_string(bst_extra_t, const char* s);
void parse_bst_finish(bst_extra_t, yyscan_t);
int bstlex(YYSTYPE* lvalp, YYLTYPE* llocp, yyscan_t scanner);
int bstget_lineno(yyscan_t);

// defined in parse-bst.y
int bstparse(bst_extra_t, s7_pointer* parse_result, yyscan_t scanner);

#endif /* PARSE_BST_H */
