+2004-08-20 José Matos <jamatos@lyx.org>
+
+ * lyxlex.[Ch] (findToken): remove function.
+
+ * ParagraphParameters.C (findToken):
+ * bufferparams.C (findToken): replace call for previous function
+ with local copy. This local function has one more argument, the
+ read string argument.
+
2004-08-16 José Matos <jamatos@lyx.org>
* ParagraphParameters.C (write):
using std::ostringstream;
using std::string;
+// anonym namespace
+namespace {
+int findToken(char const * const str[], string const search_token)
+{
+ int i = 0;
+
+ if (search_token != "default") {
+ while (str[i][0] && str[i] != search_token) {
+ ++i;
+ }
+ if (!str[i][0]) {
+ i = -1;
+ }
+ }
+
+ return i;
+}
+
+}
+
ParagraphParameters::ParagraphParameters()
: noindent_(false),
lex.printError("Unknown spacing token: '$$Token'");
}
} else if (token == "\\align") {
- int tmpret = lex.findToken(string_align);
+ lex.next();
+ int tmpret = findToken(string_align, lex.getString());
if (tmpret == -1)
++tmpret;
align(LyXAlignment(1 << tmpret));
namespace biblio = lyx::biblio;
+// anonym namespace
+namespace {
+int findToken(char const * const str[], string const search_token)
+{
+ int i = 0;
+
+ if (search_token != "default") {
+ while (str[i][0] && str[i] != search_token) {
+ ++i;
+ }
+ if (!str[i][0]) {
+ lyxerr << "Unknown argument: '"
+ << search_token << "'\n";
+ i = -1;
+ }
+ }
+
+ return i;
+}
+
+}
+
+
struct BufferParams::Impl
{
Impl();
lex.next();
fonts = lex.getString();
} else if (token == "\\paragraph_separation") {
- int tmpret = lex.findToken(string_paragraph_separation);
+ lex.next();
+ int tmpret = findToken(string_paragraph_separation, lex.getString());
if (tmpret == -1)
++tmpret;
paragraph_separation =
pimpl_->defskip = VSpace(lex.getString());
} else if (token == "\\quotes_language") {
// FIXME: should be params.readQuotes()
- int tmpret = lex.findToken(string_quotes_language);
+ lex.next();
+ int tmpret = findToken(string_quotes_language, lex.getString());
if (tmpret == -1)
++tmpret;
InsetQuotes::quote_language tmpl =
break;
}
} else if (token == "\\papersize") {
- int tmpret = lex.findToken(string_papersize);
+ lex.next();
+ int tmpret = findToken(string_papersize, lex.getString());
if (tmpret == -1)
++tmpret;
else
papersize2 = VMARGIN_PAPER_TYPE(tmpret);
} else if (token == "\\paperpackage") {
- int tmpret = lex.findToken(string_paperpackages);
+ lex.next();
+ int tmpret = findToken(string_paperpackages, lex.getString());
if (tmpret == -1) {
++tmpret;
paperpackage = PACKAGE_NONE;
ss >> a;
author_map.push_back(pimpl_->authorlist.record(a));
} else if (token == "\\paperorientation") {
- int tmpret = lex.findToken(string_orientation);
+ lex.next();
+ int tmpret = findToken(string_orientation, lex.getString());
if (tmpret == -1)
++tmpret;
orientation =
pimpl_->pushToken(pt);
}
-
-int LyXLex::findToken(char const * const str[])
-{
- if (!next()) {
- pimpl_->printError("file ended while scanning string token");
- return -1;
- }
-
- int i = 0;
-
- string const search_token = pimpl_->getString();
-
- if (search_token != "default") {
- while (str[i][0] && str[i] != search_token) {
- ++i;
- }
- if (!str[i][0]) {
- pimpl_->printError("Unknown argument `$$Token'");
- i = -1;
- }
- }
-
- return i;
-}
-
-
LyXLex::operator void const *() const
{
// This behaviour is NOT the same as the std::streams which would