/*
 * 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_FMTSTRING_H
#define PARSE_FMTSTRING_H 1

#include "beastie.h"            // for YYSTYPE and s7_pointer
#include "yycommon.h"           // for YYLTYPE

struct fmtstring_extra_s {
    const char* current_string;
    int brace_level;
    int charno;
    void* yyscanbuf;            // cast from YY_BUFFER_STATE
};
typedef struct fmtstring_extra_s* fmtstring_extra_t;

// defined in parse-fmtstring.lex
yyscan_t parse_fmtstring_setup_string(fmtstring_extra_t, const char* s);
void parse_fmtstring_finish(fmtstring_extra_t, yyscan_t);
int fmtstringlex(YYSTYPE* lvalp, YYLTYPE* llocp, yyscan_t scanner);

// defined in parse-fmtstring.y
int fmtstringparse(fmtstring_extra_t, s7_pointer* parse_result, yyscan_t scanner);

#endif /* PARSE_FMTSTRING_H */
