4
* This file is part of FreeRCT.
5
* FreeRCT is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6
* FreeRCT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FreeRCT. If not, see <http://www.gnu.org/licenses/>.
10
/** @file scanner_funcs.h Declarations for the interface between the scanner and the parser. */
12
#ifndef SCANNER_FUNCS_H
13
#define SCANNER_FUNCS_H
18
extern int line; ///< Line number of the input file being scanned.
19
extern std::string filename; ///< Name of the file being parsed.
21
extern char *text; ///< Temporary storage for a string.
22
extern int text_size; ///< Length of #text.
23
extern int text_index; ///< Pointer into #text, pointing to the first free character.
24
void AddChar(int kar);
26
int yylex(); ///< Generated scanner function.
27
int yyparse(); ///< Generated parser function.
29
extern FILE *yyin; ///< Input stream of the scanner. See also flex(1).
30
void yyerror(const char *message);
32
/** Structure to communicate values from the scanner to the parser. */
34
int line; ///< Line number of the token.
36
int line; ///< Line number of the token.
37
long long value; ///< Number stored.
38
} number; ///< Data while communicating a NUMBER token.
40
int line; ///< Line number of the token.
41
char *value; ///< Characters stored.
42
} chars; ///< Data while communicating an IDENTIFIER or STRING token.
43
ExpressionRef expr; ///< %Expression to pass on.
44
ExpressionList *exprlist; ///< Expression list to pass on.
45
NameTable *iden_table; ///< 2D table with identifiers to pass on.
46
NameRow *iden_row; ///< Row of identifiers to pass on.
47
Group *group; ///< %Group to pass on.
48
BaseNamedValue *value; ///< A named value to pass on.
49
NamedValueList *values; ///< Sequence of named values to pass on.
52
/** Macro defining the interface type between the scanner and parser. See also flex(1). */
53
#define YYSTYPE YyStruct
55
extern NamedValueList *_parsed_data; ///< Result of parsing the input file.
58
* Setup the scanner for the new file.
59
* @param fname Name of the file being parsed.
60
* @param new_file New input stream to switch to.
62
void SetupScanner(const char *fname, FILE *new_file);