~adrian-arroyocalle/freerct/freerct

« back to all changes in this revision

Viewing changes to rcdgen/src/scanner_funcs.h

  • Committer: charlespigott at googlemail
  • Date: 2013-07-09 17:30:05 UTC
  • Revision ID: svn-v4:d3bf82d2-0c16-e458-5408-27be57bd1276:trunk:780
-Codechange: Reorganise the project files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id$ */
2
 
 
3
 
/*
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/>.
8
 
 */
9
 
 
10
 
/** @file scanner_funcs.h Declarations for the interface between the scanner and the parser. */
11
 
 
12
 
#ifndef SCANNER_FUNCS_H
13
 
#define SCANNER_FUNCS_H
14
 
 
15
 
#include <string>
16
 
#include "ast.h"
17
 
 
18
 
extern int line; ///< Line number of the input file being scanned.
19
 
extern std::string filename; ///< Name of the file being parsed.
20
 
 
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);
25
 
 
26
 
int yylex();   ///< Generated scanner function.
27
 
int yyparse(); ///< Generated parser function.
28
 
 
29
 
extern FILE *yyin; ///< Input stream of the scanner. See also flex(1).
30
 
void yyerror(const char *message);
31
 
 
32
 
/** Structure to communicate values from the scanner to the parser. */
33
 
struct YyStruct {
34
 
        int line; ///< Line number of the token.
35
 
        struct {
36
 
                int line;        ///< Line number of the token.
37
 
                long long value; ///< Number stored.
38
 
        } number; ///< Data while communicating a NUMBER token.
39
 
        struct {
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.
50
 
};
51
 
 
52
 
/** Macro defining the interface type between the scanner and parser. See also flex(1). */
53
 
#define YYSTYPE YyStruct
54
 
 
55
 
extern NamedValueList *_parsed_data; ///< Result of parsing the input file.
56
 
 
57
 
/**
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.
61
 
 */
62
 
void SetupScanner(const char *fname, FILE *new_file);
63
 
 
64
 
#endif