Menu

[r25]: / src / lemon_c.h  Maximize  Restore  History

Download this file

76 lines (66 with data), 2.2 kB

 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include "lemonpp.h"
class lemon_c: public lemon {
private:
bool mhflag;
public:
lemon_c(char *argv0, const std::string & filename, bool basisflag,
bool nolinenosflag);
virtual ~lemon_c();
virtual void doOutput();
void ReportTable();
void ReportHeader();
void makeheaders(bool mhflag);
static const char *minimum_size_type(int lwr, int upr);
void print_stack_union(FILE * out, int *plineno);
void translate_code(rule*);
void emit_code(FILE*, rule*, int*);
void emit_destructor_code(FILE * out, symbol *sp, int *lineno);
};
/*
** Each state contains a set of token transaction and a set of
** nonterminal transactions. Each of these sets makes an instance
** of the following structure. An array of these structures is used
** to order the creation of entries in the yy_action[] table.
*/
class axset {
public:
state *stp; /* A pointer to a state */
int isTkn; /* True to use tokens. False for non-terminals */
int nAction; /* Number of actions */
};
/*
** The state of the yy_action table under construction is an instance of
** the following structure
*/
class acttab {
public:
int nAction; /* Number of used slots in aAction[] */
int nActionAlloc; /* Slots allocated for aAction[] */
struct action {
int lookahead; /* Value of the lookahead token */
int action; /* Action to take on the given lookahead */
} *aAction, /* The yy_action[] table under construction */
*aLookahead; /* A single new transaction set */
int mnLookahead; /* Minimum aLookahead[].lookahead */
int mnAction; /* Action associated with mnLookahead */
int mxLookahead; /* Maximum aLookahead[].lookahead */
int nLookahead; /* Used slots in aLookahead[] */
int nLookaheadAlloc; /* Slots allocated in aLookahead[] */
acttab();
virtual ~acttab();
void do_action(int lookahead, int action);
int insert();
/* Return the number of entries in the yy_action table */
inline int size() {
return this->nAction;
}
/* The value for the N-th entry in yy_action */
inline int yyaction(int N) {
return this->aAction[N].action;
}
/* The value for the N-th entry in yy_lookahead */
inline int yylookahead(int N) {
return this->aAction[N].lookahead;
}
};