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

📄 parser.c

📁 SRI international 发布的OAA框架软件
💻 C
📖 第 1 页 / 共 3 页
字号:
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  {
    zzBLOCK(zztasp2);
    zzMake0;
    {
    if ( (LA(1)==BANG) ) {
      zzmatch(BANG); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
    }
    else {
      if ( (LA(1)==SEMI) ) {
        zzmatch(SEMI); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
      }
      else {
        if ( (LA(1)==STRING_LITERAL) ) {
          zzmatch(STRING_LITERAL); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
        }
        else {
          if ( (LA(1)==IDENT) ) {
            zzmatch(IDENT); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
          }
          else {
            if ( (LA(1)==PLUS)
 ) {
              zzmatch(PLUS); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
            }
            else {
              if ( (LA(1)==MINUS) ) {
                zzmatch(MINUS); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
              }
              else {
                if ( (LA(1)==STAR) ) {
                  zzmatch(STAR); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
                }
                else {
                  if ( (LA(1)==DIV) ) {
                    zzmatch(DIV); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
                  }
                  else {
                    if ( (LA(1)==EQUAL) ) {
                      zzmatch(EQUAL); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
                    }
                    else {
                      if ( (LA(1)==TURNSTILE)
 ) {
                        zzmatch(TURNSTILE); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
                      }
                      else {
                        if ( (LA(1)==COLON) ) {
                          zzmatch(COLON); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
                        }
                        else {
                          if ( (LA(1)==DBL_COLON) ) {
                            zzmatch(DBL_COLON); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
                          }
                          else {
                            if ( (LA(1)==SPECIAL_CHAR_LITERAL) ) {
                              zzmatch(SPECIAL_CHAR_LITERAL); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
                            }
                            else {
                              if ( (LA(1)==BACKSLASH) ) {
                                zzmatch(BACKSLASH); zzsubroot(_root, &_sibling, &_tail); zzCONSUME;
                              }
                              else {zzFAIL(1,zzerr8,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    zzEXIT(zztasp2);
    }
  }
  (*_root)->type = STRUCT; if(parser_DEBUG) printf("normalStruct\n");
  zzmatch(LPAREN);  zzCONSUME;
  nonEmptyExpressionList(zzSTR); zzlink(_root, &_sibling, &_tail);
  zzmatch(RPAREN);  zzCONSUME;
  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd3, 0x2);
  }
}

void
#ifdef __USE_PROTOS
nonEmptyExpressionList(AST**_root)
#else
nonEmptyExpressionList(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  structure(zzSTR); zzlink(_root, &_sibling, &_tail);
  {
    zzBLOCK(zztasp2);
    zzMake0;
    {
    while ( (LA(1)==COMMA)
 ) {
      zzmatch(COMMA);  zzCONSUME;
      structure(zzSTR); zzlink(_root, &_sibling, &_tail);
      zzLOOP(zztasp2);
    }
    zzEXIT(zztasp2);
    }
  }
  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd3, 0x4);
  }
}

void
#ifdef __USE_PROTOS
expressionList(AST**_root)
#else
expressionList(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  {
    zzBLOCK(zztasp2);
    zzMake0;
    {
    if ( (setwd3[LA(1)]&0x8) ) {
      structure(zzSTR); zzlink(_root, &_sibling, &_tail);
      {
        zzBLOCK(zztasp3);
        zzMake0;
        {
        while ( (LA(1)==COMMA) ) {
          zzmatch(COMMA);  zzCONSUME;
          structure(zzSTR); zzlink(_root, &_sibling, &_tail);
          zzLOOP(zztasp3);
        }
        zzEXIT(zztasp3);
        }
      }
    }
    else {
      if ( (setwd3[LA(1)]&0x10) ) {
      }
      else {zzFAIL(1,zzerr9,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
    }
    zzEXIT(zztasp2);
    }
  }
  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd3, 0x20);
  }
}

void
#ifdef __USE_PROTOS
icldataqStruct(AST**_root)
#else
icldataqStruct(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  zzmatch(ICLDATAQ_LITERAL);  zzCONSUME;
  zzmatch(LPAREN);  zzCONSUME;
  {
    zzBLOCK(zztasp2);
    zzMake0;
    {
    if ( (LA(1)==DBLQUOTED) ) {
      icldataqShortStruct(zzSTR); zzlink(_root, &_sibling, &_tail);
    }
    else {
      if ( (setwd3[LA(1)]&0x40)
 ) {
        icldataqLongStruct(zzSTR); zzlink(_root, &_sibling, &_tail);
      }
      else {zzFAIL(1,zzerr10,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
    }
    zzEXIT(zztasp2);
    }
  }
  zzmatch(RPAREN);  zzCONSUME;
  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd3, 0x80);
  }
}

void
#ifdef __USE_PROTOS
icldataqShortStruct(AST**_root)
#else
icldataqShortStruct(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  zzmatch(DBLQUOTED); zzsubroot(_root, &_sibling, &_tail);
  (*_root)->type = ICLDATAQ; if(parser_DEBUG) printf("icldataqShort\n");
 zzCONSUME;

  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd4, 0x1);
  }
}

void
#ifdef __USE_PROTOS
icldataqLongStruct(AST**_root)
#else
icldataqLongStruct(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  {
    zzBLOCK(zztasp2);
    zzMake0;
    {
    if ( (LA(1)==NUM_INTONE) ) {
      zzmatch(NUM_INTONE);  zzCONSUME;
    }
    else {
      if ( (LA(1)==NUM_INTTWO) ) {
        zzmatch(NUM_INTTWO);  zzCONSUME;
      }
      else {zzFAIL(1,zzerr11,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
    }
    zzEXIT(zztasp2);
    }
  }
  zzmatch(COMMA);  zzCONSUME;
  {
    zzBLOCK(zztasp2);
    zzMake0;
    {
    if ( (LA(1)==NUM_INTONE) ) {
      zzmatch(NUM_INTONE);  zzCONSUME;
    }
    else {
      if ( (LA(1)==NUM_INTTWO) ) {
        zzmatch(NUM_INTTWO);  zzCONSUME;
      }
      else {zzFAIL(1,zzerr12,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
    }
    zzEXIT(zztasp2);
    }
  }
  zzmatch(COMMA);  zzCONSUME;
  zzmatch(DBLQUOTED); zzsubroot(_root, &_sibling, &_tail);
  (*_root)->type = ICLDATAQ; if(parser_DEBUG) printf("icldataqLong\n");
 zzCONSUME;

  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd4, 0x2);
  }
}

void
#ifdef __USE_PROTOS
unaryExpressionNotPlusMinus(AST**_root)
#else
unaryExpressionNotPlusMinus(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  if ( (LA(1)==NUM_INTONE)
 ) {
    zzmatch(NUM_INTONE); zzsubchild(_root, &_sibling, &_tail);
    (*_root)->type = INT; if(parser_DEBUG) printf("intone\n");
 zzCONSUME;

  }
  else {
    if ( (LA(1)==NUM_INTTWO) ) {
      zzmatch(NUM_INTTWO); zzsubchild(_root, &_sibling, &_tail);
      (*_root)->type = INT; if(parser_DEBUG) printf("inttwo\n");
 zzCONSUME;

    }
    else {
      if ( (LA(1)==NUM_FLOATONE) ) {
        zzmatch(NUM_FLOATONE); zzsubchild(_root, &_sibling, &_tail);
        (*_root)->type = FLOAT; if(parser_DEBUG) printf("floatone\n");
 zzCONSUME;

      }
      else {
        if ( (LA(1)==NUM_FLOATTWO) ) {
          zzmatch(NUM_FLOATTWO); zzsubchild(_root, &_sibling, &_tail);
          (*_root)->type = FLOAT; if(parser_DEBUG) printf("floattwo\n");
 zzCONSUME;

        }
        else {
          if ( (setwd4[LA(1)]&0x4) ) {
            str(zzSTR); zzlink(_root, &_sibling, &_tail);
          }
          else {
            if ( (LA(1)==VARIABLE)
 ) {
              var(zzSTR); zzlink(_root, &_sibling, &_tail);
            }
            else {
              if ( (LA(1)==LBRACK) ) {
                list(zzSTR); zzlink(_root, &_sibling, &_tail);
              }
              else {
                if ( (setwd4[LA(1)]&0x8) ) {
                  group(zzSTR); zzlink(_root, &_sibling, &_tail);
                }
                else {zzFAIL(1,zzerr13,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
              }
            }
          }
        }
      }
    }
  }
  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd4, 0x10);
  }
}

void
#ifdef __USE_PROTOS
str(AST**_root)
#else
str(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  if ( (LA(1)==BANG) ) {
    zzmatch(BANG); zzsubchild(_root, &_sibling, &_tail);
    (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

  }
  else {
    if ( (LA(1)==SEMI) ) {
      zzmatch(SEMI); zzsubchild(_root, &_sibling, &_tail);
      (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

    }
    else {
      if ( (LA(1)==STRING_LITERAL)
 ) {
        zzmatch(STRING_LITERAL); zzsubchild(_root, &_sibling, &_tail);
        (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

      }
      else {
        if ( (LA(1)==STAR) ) {
          zzmatch(STAR); zzsubchild(_root, &_sibling, &_tail);
          (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

        }
        else {
          if ( (LA(1)==PLUS) ) {
            zzmatch(PLUS); zzsubchild(_root, &_sibling, &_tail);
            (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

          }
          else {
            if ( (LA(1)==MINUS) ) {
              zzmatch(MINUS); zzsubchild(_root, &_sibling, &_tail);
              (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

            }
            else {
              if ( (LA(1)==DIV) ) {
                zzmatch(DIV); zzsubchild(_root, &_sibling, &_tail);
                (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

              }
              else {
                if ( (LA(1)==EQUAL)
 ) {
                  zzmatch(EQUAL); zzsubchild(_root, &_sibling, &_tail);
                  (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

                }
                else {
                  if ( (LA(1)==TURNSTILE) ) {
                    zzmatch(TURNSTILE); zzsubchild(_root, &_sibling, &_tail);
                    (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

                  }
                  else {
                    if ( (LA(1)==IDENT) ) {
                      zzmatch(IDENT); zzsubchild(_root, &_sibling, &_tail);
                      (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

                    }
                    else {
                      if ( (LA(1)==SPECIAL_CHAR_LITERAL) ) {
                        zzmatch(SPECIAL_CHAR_LITERAL); zzsubchild(_root, &_sibling, &_tail);
                        (*_root)->type = STR; if(parser_DEBUG) printf("SPECIAL_CHAR_LITERAL str\n"); printf("%s\n", (*_root)->tokenData);
 zzCONSUME;

                      }
                      else {
                        if ( (LA(1)==TERM_LITERAL) ) {
                          zzmatch(TERM_LITERAL); zzsubchild(_root, &_sibling, &_tail);
                          (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

                        }
                        else {
                          if ( (LA(1)==ICLDATAQ_LITERAL)
 ) {
                            zzmatch(ICLDATAQ_LITERAL); zzsubchild(_root, &_sibling, &_tail);
                            (*_root)->type = STR; if(parser_DEBUG) printf("str\n");
 zzCONSUME;

                          }
                          else {zzFAIL(1,zzerr14,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd4, 0x20);
  }
}

void
#ifdef __USE_PROTOS
var(AST**_root)
#else
var(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  zzmatch(VARIABLE); zzsubchild(_root, &_sibling, &_tail);
  (*_root)->type = VAR; if(parser_DEBUG) printf("var\n");
 zzCONSUME;

  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd4, 0x40);
  }
}

void
#ifdef __USE_PROTOS
list(AST**_root)
#else
list(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  zzmatch(LBRACK); zzsubroot(_root, &_sibling, &_tail);
  (*_root)->type = LIST; if(parser_DEBUG) printf("list\n");
 zzCONSUME;

  expressionList(zzSTR); zzlink(_root, &_sibling, &_tail);
  zzmatch(RBRACK);  zzCONSUME;
  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd4, 0x80);
  }
}

void
#ifdef __USE_PROTOS
group(AST**_root)
#else
group(_root)
AST **_root;
#endif
{
  zzRULE;
  zzBLOCK(zztasp1);
  zzMake0;
  {
  if ( (LA(1)==LBRACE) ) {
    zzmatch(LBRACE); zzsubroot(_root, &_sibling, &_tail);
    (*_root)->type = GROUP; if(parser_DEBUG) printf("group\n");
 zzCONSUME;

    expressionList(zzSTR); zzlink(_root, &_sibling, &_tail);
    zzmatch(RBRACE);  zzCONSUME;
  }
  else {
    if ( (LA(1)==LPAREN) ) {
      zzmatch(LPAREN); zzsubroot(_root, &_sibling, &_tail);
      (*_root)->type = GROUP; if(parser_DEBUG) printf("group\n");
 zzCONSUME;

      expressionList(zzSTR); zzlink(_root, &_sibling, &_tail);
      zzmatch(RPAREN);  zzCONSUME;
    }
    else {zzFAIL(1,zzerr15,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
  }
  zzEXIT(zztasp1);
  return;
fail:
  zzEXIT(zztasp1);
  zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
  zzresynch(setwd5, 0x1);
  }
}

⌨️ 快捷键说明

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