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


C++ TokenInfo::compare方法代码示例

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


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

示例1: saveScript

void CFParser :: saveScript(TokenInfo& token, _ScriptReader& reader, Rule& rule)
{
   token.read(reader);
   while (!token.compare("=>") || token.state == dfaQuote) {
      token.writeLog();

      token.read(reader);
   }
}
开发者ID:bencz,项目名称:cpu-simulator,代码行数:9,代码来源:cfparser.cpp

示例2: if

void CFParser :: defineGrammarRule(TokenInfo& token, _ScriptReader& reader, Rule& rule)
{
   // read: terminal [nonterminal] ;
   // read: nonterminal [nonterminal2] ;

   RuleType type = rtNormal;

   while (token.value[0] != ';' || token.state == dfaQuote) {

      if (token.state == dfaQuote) {
         if (rule.terminal) {
            rule.nonterminal = defineGrammarRule(token, reader);
            break;
         }
         else rule.terminal = writeBodyText(token.value);
      }
      else if (token.compare("<=")) {
         saveScript(token, reader, rule);
      }
      else if (token.state == dfaPrivate) {
         if (rule.terminal) {
            rule.nonterminal = defineGrammarRule(token, reader);
            break;
         }
         else {
            rule.prefixPtr = defineDSARule(token, reader);

            if (StringHelper::compare(token.value, LITERAL_KEYWORD)) {
               type = rtLiteral;
            }
            else if (StringHelper::compare(token.value, NUMERIC_KEYWORD)) {
               type = rtNumeric;
            }
            else if (StringHelper::compare(token.value, EPS_KEYWORD)) {
               type = rtEps;
            }
            else if (StringHelper::compare(token.value, EOF_KEYWORD)) {
               type = rtEof;
            }
            else if (StringHelper::compare(token.value, REFERENCE_KEYWORD)) {
               type = rtReference;
            }
            else if (StringHelper::compare(token.value, SCOPE_KEYWORD)) {
               type = rtScope;
            }
            else if (StringHelper::compare(token.value, IDLE_MAPPING_KEYWORD)) {
               type = rtNewIdleVariable;
            }
            else if (StringHelper::compare(token.value, VAR_KEYWORD)) {
               type = rtVariable;
            }
            else if (StringHelper::compare(token.value, MAPPING_KEYWORD)) {
               type = rtNewVariable;
            }
            //      else if (ConstantIdentifier::compare(token.value, ANY_KEYWORD)) {
      //         type = rtAny;
      //      }
            else if (StringHelper::compare(token.value, IDENTIFIER_KEYWORD)) {
               type = rtIdentifier;
            }
         }
      }
      else if (token.state == dfaIdentifier) {
         if (rule.nonterminal == 0) {
            rule.prefixPtr = defineDSARule(token, reader);

            rule.nonterminal = mapRuleId(token.value);
         }
         else if (rule.terminal == 0) {
            type = rtChomski;

            rule.terminal = mapRuleId(token.value);
         }
         else {
            if (type == rtChomski) {
               rule.terminal = defineGrammarRule(token, reader, rule.terminal);
            }
            else rule.nonterminal = defineGrammarRule(token, reader, rule.nonterminal);
            break;
         }
      }

      token.read(reader);
   }

   rule.postfixPtr = defineDSARule(token, reader);

   defineApplyRule(rule, type);
}
开发者ID:bencz,项目名称:cpu-simulator,代码行数:89,代码来源:cfparser.cpp


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