2
/* parser.dlg -- DLG Description of scanner
4
* Generated from: dlg_p.g
6
* Terence Parr, Will Cohen, and Hank Dietz: 1989-1999
7
* Purdue University Electrical Engineering
8
* With AHPCRC, University of Minnesota
9
* ANTLR Version 1.33MR20
12
#define ANTLR_VERSION 13320
14
#include "pccts_stdio.h"
30
(*zzerr)("invalid token");
38
int func_action; /* should actions be turned into functions?*/
39
int lex_mode_counter = 0; /* keeps track of the number of %%names */
41
/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
42
/* MR1 via <<%%lexmember...>> */
44
int lexMember = 0; /* <<%%lexmemeber ...>> MR1 */
45
int lexAction = 0; /* <<%%lexaction ...>> MR1 */
46
int parserClass = 0; /* <<%%parserclass ...>> MR1 */
47
int lexPrefix = 0; /* <<%%lexprefix ...>> MR1 */
48
char theClassName[100]; /* MR11 */
49
char *pClassName=theClassName; /* MR11 */
50
int firstLexMember=1; /* MR1 */
53
void xxputc(int c) { /* MR1 */
55
void xxputc(c) /* MR1 */
59
if (parserClass) { /* MR1 */
60
*pClassName++=c; /* MR1 */
61
*pClassName=0; /* MR1 */
62
} else if (lexMember || lexPrefix) { /* MR1 */
63
if (class_stream != NULL) fputc(c,class_stream); /* MR1 */
65
fputc(c,OUT); /* MR1 */
70
void xxprintf(char *format,char *string) { /* MR1 */
72
void xxprintf(format,string) /* MR1 */
73
char *format; /* MR1 */
74
char *string; /* MR1 */
77
if (lexMember || lexPrefix || parserClass) { /* MR1 */
78
if (class_stream != NULL) /* MR1 */
79
fprintf(class_stream,format,string); /* MR1 */
81
fprintf(OUT,format,string); /* MR1 */
103
zzline++; zzskip(); DAWDLE;
116
\%\%[a-zA-Z_][a-zA-Z0-9_]*
119
p_mode_def(&zzlextext[2],lex_mode_counter++);
125
lexMember=1; /* MR1 */
126
if (firstLexMember != 0) { /* MR1 */
127
firstLexMember=0; /* MR1 */
128
p_class_def1(); /* MR1 */
130
zzmode(ACT); /* MR1 */
136
lexAction=1;zzmode(ACT);
142
parserClass=1; /* MR1 */
143
zzmode(ACT); /* MR1 */
149
lexPrefix=1;zzmode(ACT);
156
fprintf(OUT,"\n%s %sact%d()\n{ ",
157
gen_cpp?"ANTLRTokenType":"static void",
158
gen_cpp?ClassName("::"):"", ++action_no);
159
zzmode(ACT); zzskip();
225
{int t; sscanf(&zzlextext[1],"%o",&t); zzlextext[0] = t;}
231
{int t; sscanf(&zzlextext[3],"%x",&t); zzlextext[0] = t;}
237
{int t; sscanf(&zzlextext[1],"%d",&t); zzlextext[0] = t;}
273
zzlextext[0] = zzlextext[1];
287
error("unterminated action", zzline); zzmode(START);
293
if (func_action) fprintf(OUT,"}\n\n");
296
/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
297
/* MR1 via <<%%lexmember ...>> */
298
/* MR1 This is a consequence of not saving actions */
300
/* MR1 */ parserClass=0;
301
/* MR1 */ lexPrefix=0;
302
/* MR1 */ lexAction=0;
303
/* MR1 */ lexMember=0;
309
xxputc(zzlextext[0]); zzskip();
315
xxputc('>'); zzskip();
321
xxputc('\\'); zzskip();
327
xxputc(zzlextext[0]); ++zzline; zzskip();
333
zzmode(ACTION_COMMENTS); /* MR1 */
334
xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
340
zzmode(ACTION_CPP_COMMENTS); /* MR1 */
341
xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
347
xxputc(zzlextext[0]); zzskip();
361
zzmode(ACT); /* MR1 */
362
xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
368
zzline++; xxputc(zzlextext[0]); zzskip();
374
xxputc(zzlextext[0]); zzskip();
378
%%ACTION_CPP_COMMENTS
388
zzmode(ACT); zzline++; /* MR1 */
389
xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */
395
xxputc(zzlextext[0]); zzskip();