📄 scan.c
字号:
/* parser.dlg -- DLG Description of scanner
*
* Generated from: antlr.g
*
* Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
* Purdue University Electrical Engineering
* With AHPCRC, University of Minnesota
* ANTLR Version 1.33MR33
*/
#define ANTLR_VERSION 13333
#include "pcctscfg.h"
#include "pccts_stdio.h"
#include "pcctscfg.h"
#include "set.h"
#include <ctype.h>
#include "syn.h"
#include "hash.h"
#include "generic.h"
#define zzcr_attr(attr,tok,t)
#include "antlr.h"
#include "tokens.h"
#include "dlgdef.h"
LOOKAHEAD
void
#ifdef __USE_PROTOS
zzerraction(void)
#else
zzerraction()
#endif
{
(*zzerr)("invalid token");
zzadvance();
zzskip();
}
/*
* D L G tables
*
* Generated from: parser.dlg
*
* 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz
* Purdue University Electrical Engineering
* DLG Version 1.33MR33
*/
#include "mode.h"
/* maintained, but not used for now */
set AST_nodes_refd_in_actions = set_init;
int inAlt = 0;
set attribsRefdFromAction = set_init; /* MR20 */
int UsedOldStyleAttrib = 0;
int UsedNewStyleLabel = 0;
#ifdef __USE_PROTOS
char *inline_set(char *);
#else
char *inline_set();
#endif
/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
/* MR1 in DLG action */
int tokenActionActive=0; /* MR1 */
static char *
#ifdef __USE_PROTOS
getFileNameFromTheLineInfo(char *toStr, char *fromStr)
#else
getFileNameFromTheLineInfo(toStr, fromStr)
char *toStr, *fromStr;
#endif
{
int i, j, k;
if (!fromStr || !toStr) return toStr;
/* find the first " */
for (i=0;
(i<MaxFileName) &&
(fromStr[i] != '\n') &&
(fromStr[i] != '\r') &&
(fromStr[i] != '\"');
i++) /* nothing */ ;
if ( (i == MaxFileName) ||
(fromStr[i] == '\n') ||
(fromStr[i] == '\r') ) {
return toStr;
}
/* find the second " */
for (j=i+1;
(j<MaxFileName) &&
(fromStr[j] != '\n') &&
(fromStr[j] != '\r') &&
(fromStr[j] != '\"');
j++) /* nothing */ ;
if ((j == MaxFileName) ||
(fromStr[j] == '\n') ||
(fromStr[j] == '\r') ) {
return toStr;
}
/* go back until the last / or \ */
for (k=j-1;
(fromStr[k] != '\"') &&
(fromStr[k] != '/') &&
(fromStr[k] != '\\');
k--) /* nothing */ ;
/* copy the string after " / or \ into toStr */
for (i=k+1; fromStr[i] != '\"'; i++) {
toStr[i-k-1] = fromStr[i];
}
toStr[i-k-1] = '\0';
return toStr;
}
/* MR14 end of a block to support #line in antlr source code */
#ifdef __USE_PROTOS
void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */
#else
void mark_label_used_in_sem_pred(le) /* MR10 */
LabelEntry *le;
#endif
{
TokNode *tn;
require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken");
tn=(TokNode *)le->elem;
require (tn->label != 0,"mark_label_used... TokNode has no label");
tn->label_used_in_semantic_pred=1;
}
static void act1()
{
NLA = Eof;
/* L o o k F o r A n o t h e r F i l e */
{
FILE *new_input;
new_input = NextFile();
if ( new_input == NULL ) { NLA=Eof; return; }
fclose( input );
input = new_input;
zzrdstream( input );
zzskip(); /* Skip the Eof (@) char i.e continue */
}
}
static void act2()
{
NLA = 76;
zzskip();
}
static void act3()
{
NLA = 77;
zzline++; zzskip();
}
static void act4()
{
NLA = 78;
zzmode(ACTIONS); zzmore();
istackreset();
pushint(']');
}
static void act5()
{
NLA = 79;
action_file=CurFile; action_line=zzline;
zzmode(ACTIONS); zzmore();
list_free(&CurActionLabels,0); /* MR10 */
numericActionLabel=0; /* MR10 */
istackreset();
pushint('>');
}
static void act6()
{
NLA = 80;
zzmode(STRINGS); zzmore();
}
static void act7()
{
NLA = 81;
zzmode(COMMENTS); zzskip();
}
static void act8()
{
NLA = 82;
warn("Missing /*; found dangling */"); zzskip();
}
static void act9()
{
NLA = 83;
zzmode(CPP_COMMENTS); zzskip();
}
static void act10()
{
NLA = 84;
zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
}
static void act11()
{
NLA = 85;
zzline++; zzmore();
}
static void act12()
{
NLA = 86;
warn("Missing <<; found dangling >>"); zzskip();
}
static void act13()
{
NLA = WildCard;
}
static void act14()
{
NLA = 88;
FoundException = 1; /* MR6 */
FoundAtOperator = 1;
}
static void act15()
{
NLA = Pragma;
}
static void act16()
{
NLA = FirstSetSymbol;
}
static void act17()
{
NLA = 94;
}
static void act18()
{
NLA = 95;
}
static void act19()
{
NLA = 96;
}
static void act20()
{
NLA = 97;
}
static void act21()
{
NLA = 98;
}
static void act22()
{
NLA = 99;
}
static void act23()
{
NLA = 102;
}
static void act24()
{
NLA = 103;
}
static void act25()
{
NLA = 104;
}
static void act26()
{
NLA = 105;
}
static void act27()
{
NLA = 106;
}
static void act28()
{
NLA = 107;
}
static void act29()
{
NLA = 108;
}
static void act30()
{
NLA = 109;
}
static void act31()
{
NLA = 110;
}
static void act32()
{
NLA = 111;
}
static void act33()
{
NLA = 112;
}
static void act34()
{
NLA = 113;
}
static void act35()
{
NLA = 114;
}
static void act36()
{
NLA = 115;
}
static void act37()
{
NLA = 116;
}
static void act38()
{
NLA = 117;
}
static void act39()
{
NLA = 118;
}
static void act40()
{
NLA = 119;
}
static void act41()
{
NLA = 120;
}
static void act42()
{
NLA = 121;
}
static void act43()
{
NLA = 122;
}
static void act44()
{
NLA = 123;
}
static void act45()
{
NLA = 124;
}
static void act46()
{
NLA = 125;
}
static void act47()
{
NLA = 126;
}
static void act48()
{
NLA = 127;
}
static void act49()
{
NLA = 128;
}
static void act50()
{
NLA = 129;
}
static void act51()
{
NLA = 130;
}
static void act52()
{
NLA = 131;
}
static void act53()
{
NLA = 132;
}
static void act54()
{
NLA = 133;
}
static void act55()
{
NLA = 134;
}
static void act56()
{
NLA = 135;
}
static void act57()
{
NLA = NonTerminal;
while ( zzchar==' ' || zzchar=='\t' ) {
zzadvance();
}
if ( zzchar == ':' && inAlt ) NLA = LABEL;
}
static void act58()
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -