本文整理汇总了C++中Lexer::getBool方法的典型用法代码示例。如果您正苦于以下问题:C++ Lexer::getBool方法的具体用法?C++ Lexer::getBool怎么用?C++ Lexer::getBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer
的用法示例。
在下文中一共展示了Lexer::getBool方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 InsetListings::read(Lexer & lex)
{
while (lex.isOK()) {
lex.next();
string token = lex.getString();
if (token == "lstparams") {
lex.next();
string const value = lex.getString();
params().fromEncodedString(value);
} else if (token == "inline") {
lex.next();
params().setInline(lex.getBool());
} else {
// no special option, push back 'status' etc
lex.pushToken(token);
break;
}
}
InsetCollapsable::read(lex);
}
示例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: fromString
bool Font::fromString(string const & data, bool & toggle)
{
istringstream is(data);
Lexer lex;
lex.setStream(is);
int nset = 0;
while (lex.isOK()) {
string token;
if (lex.next())
token = lex.getString();
if (token.empty() || !lex.next())
break;
if (token == "family") {
int const next = lex.getInteger();
bits_.setFamily(FontFamily(next));
} else if (token == "series") {
int const next = lex.getInteger();
bits_.setSeries(FontSeries(next));
} else if (token == "shape") {
int const next = lex.getInteger();
bits_.setShape(FontShape(next));
} else if (token == "size") {
int const next = lex.getInteger();
bits_.setSize(FontSize(next));
} else if (token == "emph" || token == "underbar" ||
token == "noun" || token == "number" ||
token == "uuline" || token == "uwave" ||
token == "strikeout") {
int const next = lex.getInteger();
FontState const misc = FontState(next);
if (token == "emph")
bits_.setEmph(misc);
else if (token == "underbar")
bits_.setUnderbar(misc);
else if (token == "strikeout")
bits_.setStrikeout(misc);
else if (token == "uuline")
bits_.setUuline(misc);
else if (token == "uwave")
bits_.setUwave(misc);
else if (token == "noun")
bits_.setNoun(misc);
else if (token == "number")
bits_.setNumber(misc);
} else if (token == "color") {
int const next = lex.getInteger();
bits_.setColor(ColorCode(next));
/**
} else if (token == "background") {
int const next = lex.getInteger();
bits_.setBackground(ColorCode(next));
*/
} else if (token == "language") {
string const next = lex.getString();
setLanguage(languages.getLanguage(next));
} else if (token == "toggleall") {
toggle = lex.getBool();
} else {
// Unrecognised token
break;
}
++nset;
}
return (nset > 0);
}
示例5: 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;
}
示例6: readTemplate
void Template::readTemplate(Lexer & lex)
{
enum {
TO_GUINAME = 1,
TO_HELPTEXT,
TO_INPUTFORMAT,
TO_FILTER,
TO_AUTOMATIC,
TO_PREVIEW,
TO_TRANSFORM,
TO_FORMAT,
TO_END
};
LexerKeyword templateoptiontags[] = {
{ "automaticproduction", TO_AUTOMATIC },
{ "filefilter", TO_FILTER },
{ "format", TO_FORMAT },
{ "guiname", TO_GUINAME },
{ "helptext", TO_HELPTEXT },
{ "inputformat", TO_INPUTFORMAT },
{ "preview", TO_PREVIEW },
{ "templateend", TO_END },
{ "transform", TO_TRANSFORM }
};
PushPopHelper pph(lex, templateoptiontags);
lex.setContext("Template::readTemplate");
string token;
while (lex.isOK()) {
switch (lex.lex()) {
case TO_GUINAME:
lex.next(true);
guiName = lex.getString();
break;
case TO_HELPTEXT:
helpText = lex.getLongString("HelpTextEnd");
break;
case TO_INPUTFORMAT:
lex.next(true);
inputFormat = lex.getString();
break;
case TO_FILTER:
lex.next(true);
fileRegExp = lex.getString();
break;
case TO_AUTOMATIC:
lex.next();
automaticProduction = lex.getBool();
break;
case TO_PREVIEW:
lex >> token;
if (token == "InstantPreview")
preview_mode = PREVIEW_INSTANT;
else if (token == "Graphics")
preview_mode = PREVIEW_GRAPHICS;
else
preview_mode = PREVIEW_OFF;
break;
case TO_TRANSFORM: {
lex >> token;
TransformID id = transformIDTranslator().find(token);
if (int(id) == -1)
LYXERR0("Transform " << token << " is not recognized");
else
transformIds.push_back(id);
break;
}
case TO_FORMAT:
lex.next(true);
formats[lex.getString()].readFormat(lex);
break;
case TO_END:
return;
default:
lex.printError("external::Template::readTemplate: "
"Wrong tag: $$Token");
LASSERT(false, /**/);
break;
}
}
}
示例7: 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)
//.........这里部分代码省略.........
示例8: readFloat
//.........这里部分代码省略.........
lexrc.printError("Unknown float tag `$$Token'");
continue;
default:
break;
}
switch (le) {
case FT_TYPE:
lexrc.next();
type = lexrc.getString();
if (floatlist_.typeExist(type)) {
Floating const & fl = floatlist_.getType(type);
placement = fl.placement();
ext = fl.ext();
within = fl.within();
style = fl.style();
name = fl.name();
listname = fl.listName();
needsfloat = fl.needsFloatPkg();
listcommand = fl.listCommand();
refprefix = fl.refPrefix();
}
break;
case FT_NAME:
lexrc.next();
name = lexrc.getString();
break;
case FT_PLACEMENT:
lexrc.next();
placement = lexrc.getString();
break;
case FT_EXT:
lexrc.next();
ext = lexrc.getString();
break;
case FT_WITHIN:
lexrc.next();
within = lexrc.getString();
if (within == "none")
within.erase();
break;
case FT_STYLE:
lexrc.next();
style = lexrc.getString();
break;
case FT_LISTCOMMAND:
lexrc.next();
listcommand = lexrc.getString();
break;
case FT_REFPREFIX:
lexrc.next();
refprefix = lexrc.getString();
break;
case FT_LISTNAME:
lexrc.next();
listname = lexrc.getString();
break;
case FT_NEEDSFLOAT:
lexrc.next();
needsfloat = lexrc.getBool();
break;
case FT_HTMLATTR:
lexrc.next();
htmlattr = lexrc.getString();
break;
case FT_HTMLSTYLE:
lexrc.next();
htmlstyle = lexrc.getLongString("EndHTMLStyle");
break;
case FT_HTMLTAG:
lexrc.next();
htmltag = lexrc.getString();
break;
case FT_END:
getout = true;
break;
}
}
lexrc.popTable();
// Here we have a full float if getout == true
if (getout) {
if (!needsfloat && listcommand.empty())
LYXERR0("The layout does not provide a list command " <<
"for the builtin float `" << type << "'. LyX will " <<
"not be able to produce a float list.");
Floating fl(type, placement, ext, within, style, name,
listname, listcommand, refprefix,
htmltag, htmlattr, htmlstyle, needsfloat);
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),
docstring(), docstring());
// also define sub-float counters
docstring const subtype = "sub-" + from_ascii(type);
counters_.newCounter(subtype, from_ascii(type),
"\\alph{" + subtype + "}", docstring());
}
return getout;
}
示例9: 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));
}
}