本文整理汇总了C++中Lexer::getDocString方法的典型用法代码示例。如果您正苦于以下问题:C++ Lexer::getDocString方法的具体用法?C++ Lexer::getDocString怎么用?C++ Lexer::getDocString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer
的用法示例。
在下文中一共展示了Lexer::getDocString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
void InsetCommandParams::read(Lexer & lex)
{
lex.setContext("InsetCommandParams::read");
lex >> insetName(insetCode_).c_str();
lex >> "LatexCommand";
lex >> cmdName_;
if (!isCompatibleCommand(insetCode_, cmdName_)) {
lex.printError("Incompatible command name " + cmdName_ + ".");
throw ExceptionMessage(WarningException, _("InsetCommandParams Error: "),
_("Incompatible command name."));
}
info_ = findInfo(insetCode_, cmdName_);
string token;
while (lex.isOK()) {
lex.next();
token = lex.getString();
if (token == "\\end_inset")
break;
if (token == "preview") {
lex.next();
preview_ = lex.getBool();
continue;
}
if (info_.hasParam(token)) {
lex.next(true);
params_[token] = lex.getDocString();
} else {
lex.printError("Unknown parameter name `$$Token' for command " + cmdName_);
throw ExceptionMessage(WarningException,
_("InsetCommandParams: ") + from_ascii(cmdName_),
_("Unknown parameter name: ") + from_utf8(token));
}
}
if (token != "\\end_inset") {
lex.printError("Missing \\end_inset at this point. "
"Read: `$$Token'");
throw ExceptionMessage(WarningException,
_("InsetCommandParams Error: "),
_("Missing \\end_inset at this point: ") + from_utf8(token));
}
}
示例2: read
void ParagraphParameters::read(Lexer & lex, bool merge)
{
if (!merge)
clear();
while (lex.isOK()) {
lex.nextToken();
string const token = lex.getString();
if (token.empty())
continue;
if (token[0] != '\\') {
lex.pushToken(token);
break;
}
if (token == "\\noindent") {
noindent(true);
} else if (token == "\\indent") {
//not found in LyX files but can be used with lfuns
noindent(false);
} else if (token == "\\indent-toggle") {
//not found in LyX files but can be used with lfuns
noindent(!noindent());
} else if (token == "\\leftindent") {
lex.next();
Length value(lex.getString());
leftIndent(value);
} else if (token == "\\start_of_appendix") {
startOfAppendix(true);
} else if (token == "\\paragraph_spacing") {
lex.next();
string const tmp = rtrim(lex.getString());
if (tmp == "default") {
//not found in LyX files but can be used with lfuns
spacing(Spacing(Spacing::Default));
} else if (tmp == "single") {
spacing(Spacing(Spacing::Single));
} else if (tmp == "onehalf") {
spacing(Spacing(Spacing::Onehalf));
} else if (tmp == "double") {
spacing(Spacing(Spacing::Double));
} else if (tmp == "other") {
lex.next();
spacing(Spacing(Spacing::Other,
lex.getString()));
} else {
lex.printError("Unknown spacing token: '$$Token'");
}
} else if (token == "\\align") {
lex.next();
int tmpret = findToken(string_align, lex.getString());
if (tmpret == -1)
++tmpret;
align(LyXAlignment(1 << tmpret));
} else if (token == "\\labelwidthstring") {
lex.eatLine();
labelWidthString(lex.getDocString());
} else {
lex.pushToken(token);
break;
}
}
}
示例3: readArgument
void InsetLayout::readArgument(Lexer & lex)
{
Layout::latexarg arg;
arg.mandatory = false;
bool error = false;
bool finished = false;
arg.font = inherit_font;
arg.labelfont = inherit_font;
string nr;
lex >> nr;
while (!finished && lex.isOK() && !error) {
lex.next();
string const tok = support::ascii_lowercase(lex.getString());
if (tok.empty()) {
continue;
} else if (tok == "endargument") {
finished = true;
} else if (tok == "labelstring") {
lex.next();
arg.labelstring = lex.getDocString();
} else if (tok == "menustring") {
lex.next();
arg.menustring = lex.getDocString();
} else if (tok == "mandatory") {
lex.next();
arg.mandatory = lex.getBool();
} else if (tok == "leftdelim") {
lex.next();
arg.ldelim = lex.getDocString();
arg.ldelim = support::subst(arg.ldelim,
from_ascii("<br/>"), from_ascii("\n"));
} else if (tok == "rightdelim") {
lex.next();
arg.rdelim = lex.getDocString();
arg.rdelim = support::subst(arg.rdelim,
from_ascii("<br/>"), from_ascii("\n"));
} else if (tok == "presetarg") {
lex.next();
arg.presetarg = lex.getDocString();
} else if (tok == "tooltip") {
lex.next();
arg.tooltip = lex.getDocString();
} else if (tok == "requires") {
lex.next();
arg.requires = lex.getString();
} else if (tok == "decoration") {
lex.next();
arg.decoration = lex.getString();
} else if (tok == "font") {
arg.font = lyxRead(lex, arg.font);
} else if (tok == "labelfont") {
arg.labelfont = lyxRead(lex, arg.labelfont);
} else {
lex.printError("Unknown tag");
error = true;
}
}
if (arg.labelstring.empty())
LYXERR0("Incomplete Argument definition!");
else
latexargs_[nr] = arg;
}
示例4: readArgument
void Layout::readArgument(Lexer & lex)
{
latexarg arg;
// writeArgument() makes use of these default values
arg.mandatory = false;
arg.autoinsert = false;
bool error = false;
bool finished = false;
arg.font = inherit_font;
arg.labelfont = inherit_font;
string id;
lex >> id;
bool const itemarg = prefixIs(id, "item:");
bool const postcmd = prefixIs(id, "post:");
while (!finished && lex.isOK() && !error) {
lex.next();
string const tok = ascii_lowercase(lex.getString());
if (tok.empty()) {
continue;
} else if (tok == "endargument") {
finished = true;
} else if (tok == "labelstring") {
lex.next();
arg.labelstring = lex.getDocString();
} else if (tok == "menustring") {
lex.next();
arg.menustring = lex.getDocString();
} else if (tok == "mandatory") {
lex.next();
arg.mandatory = lex.getBool();
} else if (tok == "autoinsert") {
lex.next();
arg.autoinsert = lex.getBool();
} else if (tok == "leftdelim") {
lex.next();
arg.ldelim = lex.getDocString();
arg.ldelim = support::subst(arg.ldelim, from_ascii("<br/>"),
from_ascii("\n"));
} else if (tok == "rightdelim") {
lex.next();
arg.rdelim = lex.getDocString();
arg.rdelim = support::subst(arg.rdelim, from_ascii("<br/>"),
from_ascii("\n"));
} else if (tok == "defaultarg") {
lex.next();
arg.defaultarg = lex.getDocString();
} else if (tok == "presetarg") {
lex.next();
arg.presetarg = lex.getDocString();
} else if (tok == "tooltip") {
lex.next();
arg.tooltip = lex.getDocString();
} else if (tok == "requires") {
lex.next();
arg.requires = lex.getString();
} else if (tok == "decoration") {
lex.next();
arg.decoration = lex.getString();
} else if (tok == "font") {
arg.font = lyxRead(lex, arg.font);
} else if (tok == "labelfont") {
arg.labelfont = lyxRead(lex, arg.labelfont);
} else {
lex.printError("Unknown tag");
error = true;
}
}
if (arg.labelstring.empty())
LYXERR0("Incomplete Argument definition!");
else if (itemarg)
itemargs_[id] = arg;
else if (postcmd)
postcommandargs_[id] = arg;
else
latexargs_[id] = arg;
}
示例5: read
bool Counter::read(Lexer & lex)
{
enum {
CT_WITHIN = 1,
CT_LABELSTRING,
CT_LABELSTRING_APPENDIX,
CT_PRETTYFORMAT,
CT_END
};
LexerKeyword counterTags[] = {
{ "end", CT_END },
{ "labelstring", CT_LABELSTRING },
{ "labelstringappendix", CT_LABELSTRING_APPENDIX },
{ "prettyformat", CT_PRETTYFORMAT },
{ "within", CT_WITHIN }
};
lex.pushTable(counterTags);
bool getout = false;
while (!getout && lex.isOK()) {
int le = lex.lex();
switch (le) {
case Lexer::LEX_UNDEF:
lex.printError("Unknown counter tag `$$Token'");
continue;
default:
break;
}
switch (le) {
case CT_WITHIN:
lex.next();
master_ = lex.getDocString();
if (master_ == "none")
master_.erase();
break;
case CT_PRETTYFORMAT:
lex.next();
prettyformat_ = lex.getDocString();
break;
case CT_LABELSTRING:
lex.next();
labelstring_ = lex.getDocString();
labelstringappendix_ = labelstring_;
break;
case CT_LABELSTRING_APPENDIX:
lex.next();
labelstringappendix_ = lex.getDocString();
break;
case CT_END:
getout = true;
break;
}
}
// Here if have a full counter if getout == true
if (!getout)
LYXERR0("No End tag found for counter!");
lex.popTable();
return getout;
}
示例6: readArgument
void Layout::readArgument(Lexer & lex)
{
latexarg arg;
// writeArgument() makes use of these default values
arg.mandatory = false;
arg.nodelims = false;
arg.autoinsert = false;
arg.insertcotext = false;
bool error = false;
bool finished = false;
arg.font = inherit_font;
arg.labelfont = inherit_font;
arg.is_toc_caption = false;
arg.passthru = PT_INHERITED;
string id;
lex >> id;
bool const itemarg = prefixIs(id, "item:");
bool const postcmd = prefixIs(id, "post:");
bool const listpreamble = prefixIs(id, "listpreamble:");
while (!finished && lex.isOK() && !error) {
lex.next();
string const tok = ascii_lowercase(lex.getString());
if (tok.empty()) {
continue;
} else if (tok == "endargument") {
finished = true;
} else if (tok == "labelstring") {
lex.next();
arg.labelstring = lex.getDocString();
} else if (tok == "menustring") {
lex.next();
arg.menustring = lex.getDocString();
} else if (tok == "mandatory") {
lex.next();
arg.mandatory = lex.getBool();
} else if (tok == "autoinsert") {
lex.next();
arg.autoinsert = lex.getBool();
} else if (tok == "insertcotext") {
lex.next();
arg.insertcotext = lex.getBool();
} else if (tok == "leftdelim") {
lex.next();
arg.ldelim = lex.getDocString();
arg.ldelim = support::subst(arg.ldelim, from_ascii("<br/>"),
from_ascii("\n"));
} else if (tok == "rightdelim") {
lex.next();
arg.rdelim = lex.getDocString();
arg.rdelim = support::subst(arg.rdelim, from_ascii("<br/>"),
from_ascii("\n"));
} else if (tok == "defaultarg") {
lex.next();
arg.defaultarg = lex.getDocString();
} else if (tok == "presetarg") {
lex.next();
arg.presetarg = lex.getDocString();
} else if (tok == "tooltip") {
lex.next();
arg.tooltip = lex.getDocString();
} else if (tok == "requires") {
lex.next();
arg.requires = lex.getString();
} else if (tok == "decoration") {
lex.next();
arg.decoration = lex.getString();
} else if (tok == "newlinecmd") {
lex.next();
arg.newlinecmd = lex.getString();
} else if (tok == "font") {
arg.font = lyxRead(lex, arg.font);
} else if (tok == "labelfont") {
arg.labelfont = lyxRead(lex, arg.labelfont);
} else if (tok == "passthruchars") {
lex.next();
arg.pass_thru_chars = lex.getDocString();
} else if (tok == "passthru") {
lex.next();
docstring value = lex.getDocString();
if (value == "true" || value == "1")
arg.passthru = PT_TRUE;
else if (value == "false" || value == "0")
arg.passthru = PT_FALSE;
else
arg.passthru = PT_INHERITED;
} else if (tok == "istoccaption") {
lex.next();
arg.is_toc_caption = lex.getBool();
} else {
lex.printError("Unknown tag");
error = true;
}
}
if (arg.labelstring.empty())
LYXERR0("Incomplete Argument definition!");
else if (itemarg)
itemargs_[id] = arg;
else if (postcmd)
//.........这里部分代码省略.........
示例7: read
//.........这里部分代码省略.........
}
case TC_DEFAULTMODULE: {
lexrc.next();
string const module = lexrc.getString();
if (find(default_modules_.begin(), default_modules_.end(), module) == default_modules_.end())
default_modules_.push_back(module);
break;
}
case TC_PROVIDESMODULE: {
lexrc.next();
string const module = lexrc.getString();
if (find(provided_modules_.begin(), provided_modules_.end(), module) == provided_modules_.end())
provided_modules_.push_back(module);
break;
}
case TC_EXCLUDESMODULE: {
lexrc.next();
string const module = lexrc.getString();
// modules already have their own way to exclude other modules
if (rt == MODULE) {
LYXERR0("ExcludesModule tag cannot be used in a module!");
break;
}
if (find(excluded_modules_.begin(), excluded_modules_.end(), module) == excluded_modules_.end())
excluded_modules_.push_back(module);
break;
}
case TC_LEFTMARGIN: // left margin type
if (lexrc.next())
leftmargin_ = lexrc.getDocString();
break;
case TC_RIGHTMARGIN: // right margin type
if (lexrc.next())
rightmargin_ = lexrc.getDocString();
break;
case TC_INSETLAYOUT: {
if (!lexrc.next()) {
lexrc.printError("No name given for InsetLayout: `$$Token'.");
error = true;
break;
}
docstring const name = subst(lexrc.getDocString(), '_', ' ');
if (name.empty()) {
string s = "Could not read name for InsetLayout: `$$Token' "
+ lexrc.getString() + " is probably not valid UTF-8!";
lexrc.printError(s);
InsetLayout il;
// Since we couldn't read the name, we just scan the rest
// of the style and discard it.
il.read(lexrc, *this);
// Let's try to continue rather than abort.
// error = true;
} else if (hasInsetLayout(name)) {
InsetLayout & il = insetlayoutlist_[name];
error = !il.read(lexrc, *this);
} else {
InsetLayout il;
il.setName(name);
error = !il.read(lexrc, *this);
if (!error)
示例8: Read
void InsetCommandParams::Read(Lexer & lex, Buffer const * buffer)
{
lex.setContext("InsetCommandParams::read");
lex >> insetName(insetCode_).c_str();
lex >> "LatexCommand";
lex >> cmdName_;
if (!isCompatibleCommand(insetCode_, cmdName_)) {
lex.printError("Incompatible command name " + cmdName_ + ".");
throw ExceptionMessage(WarningException, _("InsetCommandParams Error: "),
_("Incompatible command name."));
}
info_ = findInfo(insetCode_, cmdName_);
string token;
while (lex.isOK()) {
lex.next();
token = lex.getString();
if (token == "\\end_inset")
break;
if (token == "preview") {
lex.next();
preview_ = lex.getBool();
continue;
}
if (info_.hasParam(token)) {
lex.next(true);
docstring data = lex.getDocString();
if (buffer && token == "filename") {
data = from_utf8(buffer->includedFilePath(to_utf8(data)));
} else if (buffer && token == "bibfiles") {
int i = 0;
docstring newdata;
docstring bib = support::token(data, ',', i);
while (!bib.empty()) {
bib = from_utf8(buffer->includedFilePath(to_utf8(bib), "bib"));
if (!newdata.empty())
newdata.append(1, ',');
newdata.append(bib);
bib = support::token(data, ',', ++i);
}
data = newdata;
} else if (buffer && token == "options") {
data = from_utf8(buffer->includedFilePath(to_utf8(data), "bst"));
}
params_[token] = data;
} else {
lex.printError("Unknown parameter name `$$Token' for command " + cmdName_);
throw ExceptionMessage(WarningException,
_("InsetCommandParams: ") + from_ascii(cmdName_),
_("Unknown parameter name: ") + from_utf8(token));
}
}
if (token != "\\end_inset") {
lex.printError("Missing \\end_inset at this point. "
"Read: `$$Token'");
throw ExceptionMessage(WarningException,
_("InsetCommandParams Error: "),
_("Missing \\end_inset at this point: ") + from_utf8(token));
}
}