⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parser.dlg

📁 SRI international 发布的OAA框架软件
💻 DLG
📖 第 1 页 / 共 2 页
字号:
<<
/* 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();
}
>>

<<%%lexaction

/* 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 */

  
>>

<<%%lexaction


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 */

  
>>

<<%%lexaction

#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;
}
>>


%%START

@
	<<
		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 */
    }
	>>

[\t\ ]+
	<<
		NLA = 76;
    zzskip();   
	>>

\n|\r|\r\n
	<<
		NLA = 77;
    zzline++; zzskip();   
	>>

\[
	<<
		NLA = 78;
    zzmode(ACTIONS); zzmore();
    istackreset();
    pushint(']');   
	>>

\<\<
	<<
		NLA = 79;
    action_file=CurFile; action_line=zzline;
    zzmode(ACTIONS); zzmore();
    list_free(&CurActionLabels,0);       /* MR10 */
    numericActionLabel=0;                /* MR10 */
    istackreset();
    pushint('>');   
	>>

\"
	<<
		NLA = 80;
    zzmode(STRINGS); zzmore();   
	>>

/\*
	<<
		NLA = 81;
    zzmode(COMMENTS); zzskip();   
	>>

\*/
	<<
		NLA = 82;
    warn("Missing /*; found dangling */"); zzskip();   
	>>

//
	<<
		NLA = 83;
    zzmode(CPP_COMMENTS); zzskip();   
	>>

#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)
	<<
		NLA = 84;
    
    zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
    getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
	>>

#line ~[\n\r]* (\n|\r|\r\n)
	<<
		NLA = 85;
    
    zzline++; zzmore();
	>>

\>\>
	<<
		NLA = 86;
    warn("Missing <<; found dangling \>\>"); zzskip();   
	>>

.
	<<
		NLA = WildCard;
	>>

\@
	<<
		NLA = 88;
    FoundException = 1;		/* MR6 */
    FoundAtOperator = 1;  
	>>

{\\}#pragma
	<<
		NLA = Pragma;
	>>

{\\}#FirstSetSymbol
	<<
		NLA = FirstSetSymbol;
	>>

{\\}#header
	<<
		NLA = 94;
	>>

{\\}#first
	<<
		NLA = 95;
	>>

{\\}#parser
	<<
		NLA = 96;
	>>

{\\}#tokdefs
	<<
		NLA = 97;
	>>

\}
	<<
		NLA = 98;
	>>

class
	<<
		NLA = 99;
	>>

\{
	<<
		NLA = 102;
	>>

!
	<<
		NLA = 103;
	>>

\<
	<<
		NLA = 104;
	>>

\>
	<<
		NLA = 105;
	>>

:
	<<
		NLA = 106;
	>>

;
	<<
		NLA = 107;
	>>

{\\}#lexaction
	<<
		NLA = 108;
	>>

{\\}#lexmember
	<<
		NLA = 109;
	>>

{\\}#lexprefix
	<<
		NLA = 110;
	>>

{\\}#pred
	<<
		NLA = 111;
	>>

\|\|
	<<
		NLA = 112;
	>>

&&
	<<
		NLA = 113;
	>>

\(
	<<
		NLA = 114;
	>>

\)
	<<
		NLA = 115;
	>>

{\\}#lexclass
	<<
		NLA = 116;
	>>

{\\}#errclass
	<<
		NLA = 117;
	>>

{\\}#tokclass
	<<
		NLA = 118;
	>>

..
	<<
		NLA = 119;
	>>

{\\}#token
	<<
		NLA = 120;
	>>

=
	<<
		NLA = 121;
	>>

[0-9]+
	<<
		NLA = 122;
	>>

\|
	<<
		NLA = 123;
	>>

\~
	<<
		NLA = 124;
	>>

^
	<<
		NLA = 125;
	>>

approx
	<<
		NLA = 126;
	>>

LL\(1\)
	<<
		NLA = 127;
	>>

LL\(2\)
	<<
		NLA = 128;
	>>

\*
	<<
		NLA = 129;
	>>

\+
	<<
		NLA = 130;
	>>

?
	<<
		NLA = 131;
	>>

=>
	<<
		NLA = 132;
	>>

exception
	<<
		NLA = 133;
	>>

default
	<<
		NLA = 134;
	>>

catch
	<<
		NLA = 135;
	>>

[a-z] [A-Za-z0-9_]*
	<<
		NLA = NonTerminal;
    
    while ( zzchar==' ' || zzchar=='\t' ) {
      zzadvance();
    }
    if ( zzchar == ':' && inAlt ) NLA = LABEL;
	>>

[A-Z] [A-Za-z0-9_]*
	<<
		NLA = TokenTerm;
    
    while ( zzchar==' ' || zzchar=='\t' ) {
      zzadvance();
    }
    if ( zzchar == ':' && inAlt ) NLA = LABEL;
	>>

{\\}#[A-Za-z0-9_]*
	<<
		NLA = 136;
    warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip();   
	>>


%%STRINGS

@
	<<
		NLA = Eof;
	>>

\"
	<<
		NLA = QuotedTerm;
    zzmode(START);   
	>>

\n|\r|\r\n
	<<
		NLA = 3;
    
    zzline++;
    warn("eoln found in string");
    zzskip();
	>>

\\(\n|\r|\r\n)
	<<
		NLA = 4;
    zzline++; zzmore();   
	>>

\\~[]
	<<
		NLA = 5;
    zzmore();   
	>>

~[\n\r\"\\]+
	<<
		NLA = 6;
    zzmore();   
	>>


%%ACTION_STRINGS

@
	<<
		NLA = Eof;
	>>

\"
	<<
		NLA = 7;
    zzmode(ACTIONS); zzmore();   
	>>

\n|\r|\r\n
	<<
		NLA = 8;
    
    zzline++;
    warn("eoln found in string (in user action)");
    zzskip();
	>>

\\(\n|\r|\r\n)
	<<
		NLA = 9;
    zzline++; zzmore();   
	>>

\\~[]
	<<
		NLA = 10;
    zzmore();   
	>>

~[\n\r\"\\]+
	<<
		NLA = 11;
    zzmore();   
	>>


%%ACTION_CHARS

@
	<<
		NLA = Eof;
	>>

'
	<<
		NLA = 12;
    zzmode(ACTIONS); zzmore();   
	>>

\n|\r|\r\n
	<<
		NLA = 13;
    
    zzline++;
    warn("eoln found in char literal (in user action)");
    zzskip();
	>>

\\~[]
	<<
		NLA = 14;
    zzmore();   
	>>

~[\n\r'\\]+
	<<
		NLA = 15;
    zzmore();   
	>>


%%ACTION_COMMENTS

@
	<<
		NLA = Eof;
	>>

\*/
	<<
		NLA = 16;
    zzmode(ACTIONS); zzmore();   
	>>

\*
	<<
		NLA = 17;
    zzmore();   
	>>

\n|\r|\r\n
	<<
		NLA = 18;
    zzline++; zzmore(); DAWDLE;   
	>>

~[\n\r\*]+
	<<
		NLA = 19;
    zzmore();   
	>>


%%TOK_DEF_COMMENTS

@
	<<
		NLA = Eof;
	>>

\*/
	<<
		NLA = 20;
    zzmode(PARSE_ENUM_FILE);
    zzmore();   
	>>

\*
	<<
		NLA = 21;
    zzmore();   
	>>

\n|\r|\r\n
	<<
		NLA = 22;
    zzline++; zzmore(); DAWDLE;   
	>>

~[\n\r\*]+
	<<
		NLA = 23;
    zzmore();   
	>>


%%TOK_DEF_CPP_COMMENTS

@
	<<
		NLA = Eof;
	>>

\n|\r|\r\n
	<<
		NLA = 24;
    zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE;   
	>>

~[\n\r]+
	<<
		NLA = 25;
    zzskip();   
	>>


%%ACTION_CPP_COMMENTS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -