本文整理汇总了C++中Language::highlightingSyntax方法的典型用法代码示例。如果您正苦于以下问题:C++ Language::highlightingSyntax方法的具体用法?C++ Language::highlightingSyntax怎么用?C++ Language::highlightingSyntax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Language
的用法示例。
在下文中一共展示了Language::highlightingSyntax方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: realize
void Palette::realize(const ByteArray *text, Token *objectToken)
{
scopeName_ = resourceContext()->top()->fileName();
if (scopeName_ == "default") {
scope_ = SyntaxDefinition::scope(scopeName_);
for (int i = 0; i < children()->count(); ++i) {
Style *style = cast<Style>(children()->at(i));
style->rule_ = defaultRuleByName(style->ruleName());
if (style->rule_ == Undefined) {
Token *token = childToken(objectToken, i);
token = valueToken(text, token, "name");
throw SemanticError(
Format("Undefined default style '%%'") << style->ruleName(),
text, token->i1()
);
}
styleByRule_->establish(style->rule_, style);
}
return;
}
Language *language = 0;
if (!registry()->lookupLanguageByName(scopeName_, &language))
throw SemanticError(Format("Undefined language '%%'") << scopeName_);
const SyntaxDefinition *syntax = language->highlightingSyntax();
scope_ = syntax->id();
for (int i = 0; i < children()->count(); ++i) {
Style *style = cast<Style>(children()->at(i));
try {
style->rule_ = syntax->ruleByName(style->ruleName());
styleByRule_->insert(style->rule_, style);
}
catch (DebugError &ex) {
Token *token = childToken(objectToken, i);
token = valueToken(text, token, "name");
throw SemanticError(ex.message(), text, token->i1());
}
}
}