当前位置: 首页>>代码示例>>C++>>正文


C++ Tokenizer::skipToken方法代码示例

本文整理汇总了C++中Tokenizer::skipToken方法的典型用法代码示例。如果您正苦于以下问题:C++ Tokenizer::skipToken方法的具体用法?C++ Tokenizer::skipToken怎么用?C++ Tokenizer::skipToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tokenizer的用法示例。


在下文中一共展示了Tokenizer::skipToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void Expression1::parseExpression()
{
  curToken=t.getToken();
  trm->parseTrm();

  if(curToken == 22) {
    altNum=2;
    t.skipToken();
    parseExpression();
  }
  else if(curToken == 23) {
    altNum=3;
    t.skipToken();
    parseExpression();
  }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:16,代码来源:Expression1.cpp

示例2: parseAssign

void Assign::parseAssign()
{
  curToken=t.getToken();

#ifdef ENABLE_DEBUG_PARSE
  cout<<"curToken in parseAssign-1 "<<curToken<<endl;
#endif
  //Check if current Token is an Identifier, Integer, =, +, - or ;
  //and call appropriate function
  if(curToken == 32) { exp.parseExpression(); }
  else if(curToken == 31) { exp.parseExpression(); }
  else if(curToken == 14) { t.skipToken(); parseAssign(); }
  else if(curToken == 22) { t.skipToken(); parseAssign(); }
  else if(curToken == 23) { t.skipToken(); parseAssign(); }
  else if(curToken == 12) { t.skipToken(); }
  else { cout<<"Error-while parsing "<<endl; exit(1); }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:17,代码来源:Assign.cpp

示例3: parseIN

void IN::parseIN()
{
  curToken=t.getToken();
  while(curToken != 12){
    idl.parseIdListForSS();
    curToken=t.getToken();
    t.skipToken();
  }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:9,代码来源:IN.cpp

示例4: printProgram

void Program::printProgram() {
    t.setIndex(-1);
    t.skipToken();
    curToken=t.getToken();
    //----------------------------------------------------------------//
    if(curToken == 1) {
      cout<<"program"<<endl;
      t.skipToken();
      while(curToken != 2) {
        ds.printDS();
	t.skipToken();
	curToken=t.getToken();
      }
    }
    else {
      cout<<"error 1"<<endl;
      exit(1);
    }
    cout<<endl;
    //----------------------------------------------------------------//
    if(curToken == 2) {
      cout<<"begin"<<endl;
      id.insertSpace();
      t.skipToken();
      while(curToken != 3) {
        ss.printSS();
 	t.skipToken();
	curToken=t.getToken();
      }
    }
    else {
      cout<<"error 2"<<endl;
      exit(1);
    }
    cout<<endl;
    //----------------------------------------------------------------//
    if(curToken == 3) {
      cout<<"end"<<endl;
    }
    else {
      cout<<"error 3"<<endl;
    }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:43,代码来源:Program.cpp

示例5: parseCondition

void Condition::parseCondition()
{
  curToken=t.getToken();
  if(curToken == 20) {
    altNum=1;
    comp.parseCompare();
  }
  else if(curToken == 15) {
    altNum=2;
    t.skipToken();
    parseCondition();
  }
  else if(curToken == 16) {
    t.skipToken();
    parseCondition();
    curToken=t.getToken();
    if(curToken == 18){
      altNum=3;
    }
    else if(curToken == 19){
      altNum=4;
    }
    else{
      cout<<"Error-expecting && or ||"<<endl;
      exit(0);
    }
    t.skipToken();
    parseCondition();
    curToken=t.getToken();
    if(curToken == 17) {
      t.skipToken();
    }
    else {
      cout<<"Error-expecting ]"<<endl;
      exit(0);
    }
  } 
  else {
    cout<<"Error. Exiting"<<endl;
    exit(0);
  }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:42,代码来源:Condition.cpp

示例6: parseDecl

void Decl::parseDecl()
{
  curToken=t.getToken();
  if(curToken != 4)
  {
    cout<<"Error - expecting int"<<endl; 
    exit(1);
  }
  t.skipToken();
  idl.parseIdListForDS();
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:11,代码来源:Decl.cpp

示例7: parseCompare

void Compare::parseCompare()
{
  curToken=t.getToken();
  if(curToken != 20)
  {
    cout<<"error in parseCompare-Compare.h"<<endl;
    exit(0);
  }
    t.skipToken();
    op.parseOperator();
    compOp.parseCompareOperator();
    op.parseOperator();
    curToken=t.getToken();
  if(curToken != 21)
  {
    cout<<"error in parseCompare-Compare.h"<<endl;
    exit(0);
  }
    t.skipToken();
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:20,代码来源:Compare.cpp

示例8: parseExpression

void Expression::parseExpression()
{
  curToken=t.getToken();
#ifdef ENABLE_DEBUG_PARSE
  cout<<"curToken in parseExpression "<<curToken<<endl;
#endif
  altNum=1;
  this->getTrmInstance()->parseTrm();

  if(curToken == 22) {
    altNum=2;
    t.skipToken();
    parseExpression();
  }
  else if(curToken == 23) {
    altNum=3;
    t.skipToken();
    parseExpression();
  }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:20,代码来源:Expression.cpp

示例9: parseOUT

void OUT::parseOUT()
{
  curToken=t.getToken();
  if(curToken == 11){
    t.skipToken();
    this->getidListInstance()->parseIDListForSS();
  }
  else {
    cout<<"Error-expecting write"<<endl;
    exit(0);
  }
  t.skipToken();
  curToken=t.getToken();
  if(curToken == 12) {
    cout<<"";
  }
  else {
    cout<<"Error-expecting ;"<<endl;
    exit(0);
  }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:21,代码来源:OUT.cpp

示例10: parseStmt

void Stmt::parseStmt()
{
  curToken=t.getToken();     
#ifdef ENABLE_DEBUG_PRINT
  cout<<"curToken in parseStmt "<<curToken<<endl;
#endif
 
  if(curToken == 32)
  {
    altNum=1;
    t.skipToken();
#ifdef ENABLE_DEBUG_PRINT
    cout<<"calling parseAssign"<<endl;
#endif
    assign.parseAssign();
  }

  else if(curToken == 5)
  {
    altNum=2;
#ifdef ENABLE_DEBUG_PRINT
    cout<<"calling parseIF"<<endl;
#endif
    this->getIfInstanceStmt()->parseIF();
  }

  else if(curToken == 8)
  {
    altNum=3;
#ifdef ENABLE_DEBUG_PRINT
    cout<<"calling parseLoop"<<endl;
#endif
    this->getLoopInstanceStmt()->parseLoop();
  }

  else if(curToken == 10)
  {
    altNum=4;
#ifdef ENABLE_DEBUG_PRINT
    cout<<"calling parseIN"<<endl;
#endif
    in.parseIN();
  }

  else if(curToken == 11)
  {
#ifdef ENABLE_DEBUG_PRINT
    cout<<"curToken-before calling OUT "<<curToken<<endl;
#endif
    altNum=5;
    out.parseOUT();
  }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:53,代码来源:Stmt.cpp

示例11: parseOperator

void Operator::parseOperator()
{
  curToken=t.getToken();
  if(curToken==31){
    altNum=1;
    no=t.intVal();
    t.skipToken();
  } 
  else if(curToken==32){
    altNum=2;
    id.parseIDForSS();
  }
  else if(curToken==20) {
    altNum=3;
    t.skipToken();
    exp->parseExpression();
    curToken=t.getToken();
    if(curToken != 21){
      cout<<"Error-expecting )"<<endl;
      exit(0);
    }
    t.skipToken();
  } 
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:24,代码来源:Operator.cpp

示例12: parseIDForSS

ID* ID::parseIDForSS()
{
    string idName=t.getIdName();
    for(int k=0; k<idCount; k++)
    {
        if(idName==eIDs[k]->name) {
            t.skipToken();
            return eIDs[k];
        }
        else {
            cout<<"Error - variable has already been declared"<<endl;
            exit(0);
        }
    }
}
开发者ID:xu3z,项目名称:CSE-655,代码行数:15,代码来源:ID.cpp

示例13: parseIDListForDS

void idList::parseIDListForDS()
{
  curToken=t.getToken();
  if(curToken == 13){
    t.skipToken();
    curToken=t.getToken();
    if(curToken == 32){
      id.parseIDForDS();
    } 
    else {
      cout<<"Error-Expecting an integer value. Exiting"<<endl;
      exit(0);
    }
  }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:15,代码来源:idList.cpp

示例14: parseProgram

void Program::parseProgram() {
    t.setIndex(-1);
    t.skipToken();
    curToken=t.getToken();
    //----------------------------------------------------------------//
    if(curToken == 1) {
      t.skipToken();
      curToken=t.getToken();
      while(curToken != 2) {
        ds.parseDS(); 
        t.skipToken();
        curToken=t.getToken();
      }
    }
    else {
      cout<<"error 1"<<endl;
      exit(1);
    }
    cout<<endl;
    //----------------------------------------------------------------
    if(curToken == 2) {
      t.skipToken();
      curToken=t.getToken();
      while(curToken != 3) {
        ss.parseSS(); 
        t.skipToken();
        curToken=t.getToken();
      }
    }
    else {
      cout<<"error 2"<<endl;
      exit(1);
    }
    cout<<endl;
    //----------------------------------------------------------------//
    if(curToken == 3) {
      t.skipToken();
      curToken=t.getToken();
      cout<<"End of Parsing. No errors found"<<endl;
    }
    else {
      cout<<"error 3"<<endl;
      exit(1);
    }
}
开发者ID:mmananth,项目名称:CSE-655,代码行数:45,代码来源:Program.cpp

示例15: parse

/* ParseTreeNode::parse
 * Parses formatted text data. Current valid formatting is:
 * (type) child = value;
 * (type) child = value1, value2, ...;
 * (type) child = { value1, value2, ... }
 * (type) child { grandchild = value; etc... }
 * (type) child : inherited { ... }
 * All values are read as strings, but can be retrieved as string,
 * int, bool or float.
 *******************************************************************/
bool ParseTreeNode::parse(Tokenizer& tz)
{
    // Get first token
    string token = tz.getToken();

    // Keep parsing until final } is reached (or end of file)
    while (!(S_CMP(token, "}")) && !token.IsEmpty())
    {
        // Check for preprocessor stuff
        if (parser)
        {
            // #define
            if (S_CMPNOCASE(token, "#define"))
            {
                parser->define(tz.getToken());
                token = tz.getToken();
                continue;
            }

            // #if(n)def
            if (S_CMPNOCASE(token, "#ifdef") || S_CMPNOCASE(token, "#ifndef"))
            {
                bool test = true;
                if (S_CMPNOCASE(token, "#ifndef"))
                    test = false;
                string define = tz.getToken();
                if (parser->defined(define) == test)
                {
                    // Continue
                    token = tz.getToken();
                    continue;
                }
                else
                {
                    // Skip section
                    int skip = 0;
                    while (true)
                    {
                        token = tz.getToken();
                        if (S_CMPNOCASE(token, "#endif"))
                            skip--;
                        else if (S_CMPNOCASE(token, "#ifdef"))
                            skip++;
                        else if (S_CMPNOCASE(token, "#ifndef"))
                            skip++;

                        if (skip < 0)
                            break;
                        if (token.IsEmpty())
                        {
                            wxLogMessage("Error: found end of file within #if(n)def block");
                            break;
                        }
                    }

                    continue;
                }
            }

            // #include (ignore)
            if (S_CMPNOCASE(token, "#include"))
            {
                tz.skipToken();	// Skip include path
                token = tz.getToken();
                continue;
            }

            // #endif (ignore)
            if (S_CMPNOCASE(token, "#endif"))
            {
                token = tz.getToken();
                continue;
            }
        }

        // If it's a special character (ie not a valid name), parsing fails
        if (tz.isSpecialCharacter(token.at(0)))
        {
            wxLogMessage("Parsing error: Unexpected special character '%s' in %s (line %d)", CHR(token), CHR(tz.getName()), tz.lineNo());
            return false;
        }

        // So we have either a node or property name
        string name = token;

        // Check next token to determine what we're doing
        string next = tz.peekToken();

        // Check for type+name pair
        string type = "";
//.........这里部分代码省略.........
开发者ID:Zekom,项目名称:SLADE,代码行数:101,代码来源:Parser.cpp


注:本文中的Tokenizer::skipToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。