-
Notifications
You must be signed in to change notification settings - Fork 7
/
LGParser.h.skl
96 lines (81 loc) · 3.16 KB
/
LGParser.h.skl
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#pragma once
@("char", "uchar", "short", "ushort", "int", "uint", "char*")
@//
/////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// LGParser.h
/* Generated by: @program; @version;
Grammar: @grm_file;
Skeleton: @skl_file;
Output: @out_file;
*/
#include "LGLexer.h"
@numb_tact?;...
#define TOKEN_ACTIONS
@@
@numb_pact?;...
#define PARSE_ACTIONS
@@
@numb_nact?;...
#define NODE_ACTIONS
@@
@def_cons?;...
// Defined constants ...
@def_cons.1|#undef %15s||\n |;
@def_cons.1|#define %15s %5d // %T||\n |;
@@
@numb_node?;...
// Defined constants for the node names ...
@node_name.1|#define %15u %5d||\n |;
@@
class LGParser : public LGLexer
{
public:
// Functions ...
static void initialize (int);
static int Parse ();
static int parse ();
static void terminate ();
static void syntax_error (int);
// Variables ...
static PStack* PS; // Parse Stack pointer.
static PStack* PS_end; // Parse Stack end.
static @pact_arg. 8t; pact_arg[]; // Parse-action argument index (for first arg).
static @nact_arg. 8t; nact_arg[]; // Node-action argument index (for first arg).
static @arg_numb. 8t; arg_numb[]; // Argument numbers.
static @arg_text. 8t; arg_text[]; // Argument text (for string arguments).
static @head_prod.8t; f_prod[];
static @prod_tail.8t; f_tail[];
static char* T_start;
static char* T_end;
static int T_line;
private:
// Functions ...
static int nd_parse (int*, int*, int*, int x, int t, int a);
static int apply (int p);
static int linkup (int p);
static void rebuild ();
static short err_rec (short, short);
static short lookahead (short t, short x);
static void get_list (short);
static void prt_token (short);
static void prt_prod (short);
static void prt_stack ();
static void expecting ();
static void restore ();
static void collect (int x);
static void reduce (int p, int x);
static void prt_list (int t);
static char* prt_line (char* ls, int ln);
static void prt_pointer (char* ls, int ln, char* token);
// Variables ...
static int max_errs; // Maximum allowable errors.
static RStack* RS; // Reduction Stack pointer.
static char* T_list; // Terminal symbol list (0 or 1).
static char* H_list; // Head symbol list (0 or 1).
static int* P_list; // Production list.
static RStack R_stack[]; // Reduction stack.
static PStack P_stack[]; // Parser stack.
static PStack* PStop; // Top pointer for Parser stack.
static int topstate; // Top state (before reductions start).
};