本文整理汇总了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);
}
}
示例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);
}