-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlyutils.h
60 lines (47 loc) · 1.12 KB
/
lyutils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Wai Chun Leung
// wleung11
// Shineng Tang
// stang38
// $Id: lyutils.h,v 1.7 2019-04-18 13:33:21-07 - - $
#ifndef __UTILS_H__
#define __UTILS_H__
// Lex and Yacc interface utility.
#include <string>
#include <vector>
using namespace std;
#include <stdio.h>
#include "astree.h"
#include "auxlib.h"
#define YYEOF 0
extern FILE* yyin;
extern char* yytext;
extern int yy_flex_debug;
extern int yydebug;
extern size_t yyleng;
extern FILE* tok_out;
int yylex();
int yylex_destroy();
int yyparse();
void yyerror (const char* message);
struct lexer {
static bool interactive;
static location lloc;
static size_t last_yyleng;
static vector<string> filenames;
static const string* filename (int filenr);
static void newfilename (const string& filename);
static void advance();
static void newline();
static void badchar (unsigned char bad);
static void include();
static int token (int symbol);
static int badtoken (int symbol);
};
struct parser {
static astree* root;
static const char* get_tname (int symbol);
};
#define YYSTYPE_IS_DECLARED
typedef astree* YYSTYPE;
#include "yyparse.h"
#endif