rename LyXLex into Lexer

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18033 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-04-26 11:30:54 +00:00
parent c22d1bb430
commit 39e79d8602
113 changed files with 402 additions and 402 deletions

View File

@ -32,7 +32,7 @@
#include "LaTeX.h" #include "LaTeX.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXText.h" #include "LyXText.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "LyXVC.h" #include "LyXVC.h"
@ -406,7 +406,7 @@ void unknownClass(string const & unknown)
} // anon } // anon
int Buffer::readHeader(LyXLex & lex) int Buffer::readHeader(Lexer & lex)
{ {
int unknown_tokens = 0; int unknown_tokens = 0;
int line = -1; int line = -1;
@ -480,7 +480,7 @@ int Buffer::readHeader(LyXLex & lex)
// Uwe C. Schroeder // Uwe C. Schroeder
// changed to be public and have one parameter // changed to be public and have one parameter
// Returns false if "\end_document" is not read (Asger) // Returns false if "\end_document" is not read (Asger)
bool Buffer::readDocument(LyXLex & lex) bool Buffer::readDocument(Lexer & lex)
{ {
ErrorList & errorList = errorLists_["Parse"]; ErrorList & errorList = errorLists_["Parse"];
errorList.clear(); errorList.clear();
@ -574,7 +574,7 @@ bool Buffer::readString(std::string const & s)
// remove dummy empty par // remove dummy empty par
paragraphs().clear(); paragraphs().clear();
LyXLex lex(0, 0); Lexer lex(0, 0);
std::istringstream is(s); std::istringstream is(s);
lex.setStream(is); lex.setStream(is);
FileName const name(tempName()); FileName const name(tempName());
@ -606,7 +606,7 @@ bool Buffer::readFile(FileName const & filename)
// remove dummy empty par // remove dummy empty par
paragraphs().clear(); paragraphs().clear();
LyXLex lex(0, 0); Lexer lex(0, 0);
lex.setFile(filename); lex.setFile(filename);
if (readFile(lex, filename) != success) if (readFile(lex, filename) != success)
return false; return false;
@ -627,7 +627,7 @@ void Buffer::fully_loaded(bool const value)
} }
Buffer::ReadStatus Buffer::readFile(LyXLex & lex, FileName const & filename, Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename,
bool fromstring) bool fromstring)
{ {
BOOST_ASSERT(!filename.empty()); BOOST_ASSERT(!filename.empty());

View File

@ -41,7 +41,7 @@ class FuncRequest;
class InsetBase; class InsetBase;
class InsetText; class InsetText;
class LyXFont; class LyXFont;
class LyXLex; class Lexer;
class LyXRC; class LyXRC;
class LyXText; class LyXText;
class LyXVC; class LyXVC;
@ -111,13 +111,13 @@ public:
bool readFile(support::FileName const & filename); bool readFile(support::FileName const & filename);
/// read the header, returns number of unknown tokens /// read the header, returns number of unknown tokens
int readHeader(LyXLex & lex); int readHeader(Lexer & lex);
/** Reads a file without header. /** Reads a file without header.
\param par if != 0 insert the file. \param par if != 0 insert the file.
\return \c false if file is not completely read. \return \c false if file is not completely read.
*/ */
bool readDocument(LyXLex &); bool readDocument(Lexer &);
/// ///
void insertStringAsLines(ParagraphList & plist, void insertStringAsLines(ParagraphList & plist,
@ -394,7 +394,7 @@ private:
/** Inserts a file into a document /** Inserts a file into a document
\return \c false if method fails. \return \c false if method fails.
*/ */
ReadStatus readFile(LyXLex &, support::FileName const & filename, ReadStatus readFile(Lexer &, support::FileName const & filename,
bool fromString = false); bool fromString = false);
/// Use the Pimpl idiom to hide the internals. /// Use the Pimpl idiom to hide the internals.

View File

@ -27,7 +27,7 @@
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LColor.h" #include "LColor.h"
#include "LyXFont.h" #include "LyXFont.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "LyXTextClassList.h" #include "LyXTextClassList.h"
#include "OutputParams.h" #include "OutputParams.h"
@ -411,7 +411,7 @@ void BufferParams::setDefSkip(VSpace const & vs)
} }
string const BufferParams::readToken(LyXLex & lex, string const & token) string const BufferParams::readToken(Lexer & lex, string const & token)
{ {
if (token == "\\textclass") { if (token == "\\textclass") {
lex.next(); lex.next();
@ -1187,7 +1187,7 @@ LyXFont const BufferParams::getFont() const
} }
void BufferParams::readPreamble(LyXLex & lex) void BufferParams::readPreamble(Lexer & lex)
{ {
if (lex.getString() != "\\begin_preamble") if (lex.getString() != "\\begin_preamble")
lyxerr << "Error (BufferParams::readPreamble):" lyxerr << "Error (BufferParams::readPreamble):"
@ -1197,7 +1197,7 @@ void BufferParams::readPreamble(LyXLex & lex)
} }
void BufferParams::readLanguage(LyXLex & lex) void BufferParams::readLanguage(Lexer & lex)
{ {
if (!lex.next()) return; if (!lex.next()) return;
@ -1215,7 +1215,7 @@ void BufferParams::readLanguage(LyXLex & lex)
} }
void BufferParams::readGraphicsDriver(LyXLex & lex) void BufferParams::readGraphicsDriver(Lexer & lex)
{ {
if (!lex.next()) return; if (!lex.next()) return;
@ -1239,7 +1239,7 @@ void BufferParams::readGraphicsDriver(LyXLex & lex)
} }
void BufferParams::readBullets(LyXLex & lex) void BufferParams::readBullets(Lexer & lex)
{ {
if (!lex.next()) return; if (!lex.next()) return;
@ -1257,7 +1257,7 @@ void BufferParams::readBullets(LyXLex & lex)
} }
void BufferParams::readBulletsLaTeX(LyXLex & lex) void BufferParams::readBulletsLaTeX(Lexer & lex)
{ {
// The bullet class should be able to read this. // The bullet class should be able to read this.
if (!lex.next()) return; if (!lex.next()) return;

View File

@ -34,7 +34,7 @@ class AuthorList;
class BranchList; class BranchList;
class Bullet; class Bullet;
class Encoding; class Encoding;
class LyXLex; class Lexer;
class LatexFeatures; class LatexFeatures;
class Spacing; class Spacing;
class TexRow; class TexRow;
@ -61,7 +61,7 @@ public:
~BufferParams(); ~BufferParams();
/// read a header token, if unrecognised, return it or an unknown class name /// read a header token, if unrecognised, return it or an unknown class name
std::string const readToken(LyXLex & lex, std::string const & token); std::string const readToken(Lexer & lex, std::string const & token);
/// ///
void writeFile(std::ostream &) const; void writeFile(std::ostream &) const;
@ -197,15 +197,15 @@ public:
Bullet & user_defined_bullet(size_type index); Bullet & user_defined_bullet(size_type index);
Bullet const & user_defined_bullet(size_type index) const; Bullet const & user_defined_bullet(size_type index) const;
/// ///
void readPreamble(LyXLex &); void readPreamble(Lexer &);
/// ///
void readLanguage(LyXLex &); void readLanguage(Lexer &);
/// ///
void readGraphicsDriver(LyXLex &); void readGraphicsDriver(Lexer &);
/// ///
void readBullets(LyXLex &); void readBullets(Lexer &);
/// ///
void readBulletsLaTeX(LyXLex &); void readBulletsLaTeX(Lexer &);
/// Whether to load a package such as amsmath or esint. /// Whether to load a package such as amsmath or esint.
/// The enum values must not be changed (file format!) /// The enum values must not be changed (file format!)

View File

@ -7043,12 +7043,12 @@
* bufferparams.h: add compressed var * bufferparams.h: add compressed var
* buffer_funcs.C (readFile): adjust for LyXLex change * buffer_funcs.C (readFile): adjust for Lexer change
(newFile): ditto + simplify (newFile): ditto + simplify
* buffer.C (writeFile): handle writing of compressed files * buffer.C (writeFile): handle writing of compressed files
* buffer.[Ch] (readFile): begin LyXLex here, remove one argument. * buffer.[Ch] (readFile): begin Lexer here, remove one argument.
Check if the file is compressed and set a bufferparm if so. Check if the file is compressed and set a bufferparm if so.
* Makefile.am (lyx_LDADD): remove explicit -lz * Makefile.am (lyx_LDADD): remove explicit -lz

View File

@ -17,7 +17,7 @@
namespace lyx { namespace lyx {
class LyXLex; class Lexer;
class TeXErrors; class TeXErrors;

View File

@ -16,7 +16,7 @@
#include "debug.h" #include "debug.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "support/FileName.h" #include "support/FileName.h"
@ -278,7 +278,7 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
{ {
// We must read the symbolsfile first, because the Encoding // We must read the symbolsfile first, because the Encoding
// constructor depends on it. // constructor depends on it.
LyXLex symbolslex(0, 0); Lexer symbolslex(0, 0);
symbolslex.setFile(symbolsfile); symbolslex.setFile(symbolsfile);
while (symbolslex.isOK()) { while (symbolslex.isOK()) {
char_type symbol; char_type symbol;
@ -348,7 +348,7 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
{ "end", et_end } { "end", et_end }
}; };
LyXLex lex(encodingtags, et_last - 1); Lexer lex(encodingtags, et_last - 1);
lex.setFile(encfile); lex.setFile(encfile);
while (lex.isOK()) { while (lex.isOK()) {
switch (lex.lex()) { switch (lex.lex()) {
@ -370,7 +370,7 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
case et_end: case et_end:
lex.printError("Encodings::read: Misplaced end"); lex.printError("Encodings::read: Misplaced end");
break; break;
case LyXLex::LEX_FEOF: case Lexer::LEX_FEOF:
break; break;
default: default:
lex.printError("Encodings::read: " lex.printError("Encodings::read: "

View File

@ -24,7 +24,7 @@
#include "FloatList.h" #include "FloatList.h"
#include "LColor.h" #include "LColor.h"
#include "Language.h" #include "Language.h"
#include "LyXLex.h" #include "Lexer.h"
#include "lyx_sty.h" #include "lyx_sty.h"
#include "LyXRC.h" #include "LyXRC.h"
@ -76,7 +76,7 @@ void LaTeXFeatures::require(string const & name)
void LaTeXFeatures::getAvailable() void LaTeXFeatures::getAvailable()
{ {
LyXLex lex(0, 0); Lexer lex(0, 0);
support::FileName const real_file = libFileSearch("", "packages.lst"); support::FileName const real_file = libFileSearch("", "packages.lst");
if (real_file.empty()) if (real_file.empty())
@ -94,7 +94,7 @@ void LaTeXFeatures::getAvailable()
// Parse config-file // Parse config-file
while (lex.isOK() && !finished) { while (lex.isOK() && !finished) {
switch (lex.lex()) { switch (lex.lex()) {
case LyXLex::LEX_FEOF: case Lexer::LEX_FEOF:
finished = true; finished = true;
break; break;
default: default:

View File

@ -16,7 +16,7 @@
#include "debug.h" #include "debug.h"
#include "Encoding.h" #include "Encoding.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "support/FileName.h" #include "support/FileName.h"
@ -44,7 +44,7 @@ void Languages::read(support::FileName const & filename)
encodings.getFromLyXName("iso8859-1"), encodings.getFromLyXName("iso8859-1"),
"latex", ""); "latex", "");
LyXLex lex(0, 0); Lexer lex(0, 0);
lex.setFile(filename); lex.setFile(filename);
while (lex.isOK()) { while (lex.isOK()) {
string lang; string lang;

View File

@ -1,5 +1,5 @@
/** /**
* \file LyXLex.cpp * \file Lexer.cpp
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
@ -13,7 +13,7 @@
#include <config.h> #include <config.h>
#include "LyXLex.h" #include "Lexer.h"
#include "debug.h" #include "debug.h"
@ -64,13 +64,13 @@ using std::ostream;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
// LyXLex::Pimpl // Lexer::Pimpl
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/// ///
class LyXLex::Pimpl : boost::noncopyable { class Lexer::Pimpl : boost::noncopyable {
public: public:
/// ///
Pimpl(keyword_item * tab, int num); Pimpl(keyword_item * tab, int num);
@ -171,7 +171,7 @@ public:
} // end of anon namespace } // end of anon namespace
LyXLex::Pimpl::Pimpl(keyword_item * tab, int num) Lexer::Pimpl::Pimpl(keyword_item * tab, int num)
: is(&fb_), table(tab), no_items(num), : is(&fb_), table(tab), no_items(num),
status(0), lineno(0), commentChar('#') status(0), lineno(0), commentChar('#')
{ {
@ -179,19 +179,19 @@ LyXLex::Pimpl::Pimpl(keyword_item * tab, int num)
} }
string const LyXLex::Pimpl::getString() const string const Lexer::Pimpl::getString() const
{ {
return buff; return buff;
} }
docstring const LyXLex::Pimpl::getDocString() const docstring const Lexer::Pimpl::getDocString() const
{ {
return from_utf8(buff); return from_utf8(buff);
} }
void LyXLex::Pimpl::printError(string const & message) const void Lexer::Pimpl::printError(string const & message) const
{ {
string const tmpmsg = subst(message, "$$Token", getString()); string const tmpmsg = subst(message, "$$Token", getString());
lyxerr << "LyX: " << tmpmsg << " [around line " << lineno lyxerr << "LyX: " << tmpmsg << " [around line " << lineno
@ -199,7 +199,7 @@ void LyXLex::Pimpl::printError(string const & message) const
} }
void LyXLex::Pimpl::printTable(ostream & os) void Lexer::Pimpl::printTable(ostream & os)
{ {
os << "\nNumber of tags: " << no_items << endl; os << "\nNumber of tags: " << no_items << endl;
for (int i= 0; i < no_items; ++i) for (int i= 0; i < no_items; ++i)
@ -210,12 +210,12 @@ void LyXLex::Pimpl::printTable(ostream & os)
} }
void LyXLex::Pimpl::verifyTable() void Lexer::Pimpl::verifyTable()
{ {
// Check if the table is sorted and if not, sort it. // Check if the table is sorted and if not, sort it.
if (table if (table
&& !lyx::sorted(table, table + no_items, compare_tags())) { && !lyx::sorted(table, table + no_items, compare_tags())) {
lyxerr << "The table passed to LyXLex is not sorted!\n" lyxerr << "The table passed to Lexer is not sorted!\n"
<< "Tell the developers to fix it!" << endl; << "Tell the developers to fix it!" << endl;
// We sort it anyway to avoid problems. // We sort it anyway to avoid problems.
lyxerr << "\nUnsorted:" << endl; lyxerr << "\nUnsorted:" << endl;
@ -228,7 +228,7 @@ void LyXLex::Pimpl::verifyTable()
} }
void LyXLex::Pimpl::pushTable(keyword_item * tab, int num) void Lexer::Pimpl::pushTable(keyword_item * tab, int num)
{ {
pushed_table tmppu(table, no_items); pushed_table tmppu(table, no_items);
pushed.push(tmppu); pushed.push(tmppu);
@ -240,10 +240,10 @@ void LyXLex::Pimpl::pushTable(keyword_item * tab, int num)
} }
void LyXLex::Pimpl::popTable() void Lexer::Pimpl::popTable()
{ {
if (pushed.empty()) { if (pushed.empty()) {
lyxerr << "LyXLex error: nothing to pop!" << endl; lyxerr << "Lexer error: nothing to pop!" << endl;
return; return;
} }
@ -254,7 +254,7 @@ void LyXLex::Pimpl::popTable()
} }
bool LyXLex::Pimpl::setFile(FileName const & filename) bool Lexer::Pimpl::setFile(FileName const & filename)
{ {
// Check the format of the file. // Check the format of the file.
string const format = getFormatFromContents(filename); string const format = getFormatFromContents(filename);
@ -266,7 +266,7 @@ bool LyXLex::Pimpl::setFile(FileName const & filename)
// a bug in compaq cxx 6.2, where is_open() returns 'true' for // a bug in compaq cxx 6.2, where is_open() returns 'true' for
// a fresh new filebuf. (JMarc) // a fresh new filebuf. (JMarc)
if (!gz_.empty() || istream::off_type(is.tellg()) > -1) if (!gz_.empty() || istream::off_type(is.tellg()) > -1)
LYXERR(Debug::LYXLEX) << "Error in LyXLex::setFile: " LYXERR(Debug::LYXLEX) << "Error in Lexer::setFile: "
"file or stream already set." << endl; "file or stream already set." << endl;
gz_.push(io::gzip_decompressor()); gz_.push(io::gzip_decompressor());
gz_.push(io::file_source(filename.toFilesystemEncoding())); gz_.push(io::file_source(filename.toFilesystemEncoding()));
@ -281,7 +281,7 @@ bool LyXLex::Pimpl::setFile(FileName const & filename)
// a bug in compaq cxx 6.2, where is_open() returns 'true' for // a bug in compaq cxx 6.2, where is_open() returns 'true' for
// a fresh new filebuf. (JMarc) // a fresh new filebuf. (JMarc)
if (fb_.is_open() || istream::off_type(is.tellg()) > 0) if (fb_.is_open() || istream::off_type(is.tellg()) > 0)
LYXERR(Debug::LYXLEX) << "Error in LyXLex::setFile: " LYXERR(Debug::LYXLEX) << "Error in Lexer::setFile: "
"file or stream already set." << endl; "file or stream already set." << endl;
fb_.open(filename.toFilesystemEncoding().c_str(), ios::in); fb_.open(filename.toFilesystemEncoding().c_str(), ios::in);
is.rdbuf(&fb_); is.rdbuf(&fb_);
@ -292,23 +292,23 @@ bool LyXLex::Pimpl::setFile(FileName const & filename)
} }
void LyXLex::Pimpl::setStream(istream & i) void Lexer::Pimpl::setStream(istream & i)
{ {
if (fb_.is_open() || istream::off_type(is.tellg()) > 0) if (fb_.is_open() || istream::off_type(is.tellg()) > 0)
LYXERR(Debug::LYXLEX) << "Error in LyXLex::setStream: " LYXERR(Debug::LYXLEX) << "Error in Lexer::setStream: "
"file or stream already set." << endl; "file or stream already set." << endl;
is.rdbuf(i.rdbuf()); is.rdbuf(i.rdbuf());
lineno = 0; lineno = 0;
} }
void LyXLex::Pimpl::setCommentChar(char c) void Lexer::Pimpl::setCommentChar(char c)
{ {
commentChar = c; commentChar = c;
} }
bool LyXLex::Pimpl::next(bool esc /* = false */) bool Lexer::Pimpl::next(bool esc /* = false */)
{ {
if (!pushTok.empty()) { if (!pushTok.empty()) {
// There can have been a whole line pushed so // There can have been a whole line pushed so
@ -506,7 +506,7 @@ bool LyXLex::Pimpl::next(bool esc /* = false */)
} }
int LyXLex::Pimpl::search_kw(char const * const tag) const int Lexer::Pimpl::search_kw(char const * const tag) const
{ {
keyword_item search_tag = { tag, 0 }; keyword_item search_tag = { tag, 0 };
keyword_item * res = keyword_item * res =
@ -522,7 +522,7 @@ int LyXLex::Pimpl::search_kw(char const * const tag) const
} }
int LyXLex::Pimpl::lex() int Lexer::Pimpl::lex()
{ {
//NOTE: possible bug. //NOTE: possible bug.
if (next() && status == LEX_TOKEN) if (next() && status == LEX_TOKEN)
@ -531,7 +531,7 @@ int LyXLex::Pimpl::lex()
} }
bool LyXLex::Pimpl::eatLine() bool Lexer::Pimpl::eatLine()
{ {
buff.clear(); buff.clear();
@ -540,7 +540,7 @@ bool LyXLex::Pimpl::eatLine()
while (is && c != '\n') { while (is && c != '\n') {
is.get(cc); is.get(cc);
c = cc; c = cc;
//LYXERR(Debug::LYXLEX) << "LyXLex::EatLine read char: `" //LYXERR(Debug::LYXLEX) << "Lexer::EatLine read char: `"
// << c << '\'' << endl; // << c << '\'' << endl;
if (c != '\r') if (c != '\r')
buff.push_back(c); buff.push_back(c);
@ -560,7 +560,7 @@ bool LyXLex::Pimpl::eatLine()
} }
bool LyXLex::Pimpl::nextToken() bool Lexer::Pimpl::nextToken()
{ {
if (!pushTok.empty()) { if (!pushTok.empty()) {
// There can have been a whole line pushed so // There can have been a whole line pushed so
@ -617,13 +617,13 @@ bool LyXLex::Pimpl::nextToken()
} }
bool LyXLex::Pimpl::inputAvailable() bool Lexer::Pimpl::inputAvailable()
{ {
return is.good(); return is.good();
} }
void LyXLex::Pimpl::pushToken(string const & pt) void Lexer::Pimpl::pushToken(string const & pt)
{ {
pushTok = pt; pushTok = pt;
} }
@ -633,93 +633,93 @@ void LyXLex::Pimpl::pushToken(string const & pt)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
// LyXLex // Lexer
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
LyXLex::LyXLex(keyword_item * tab, int num) Lexer::Lexer(keyword_item * tab, int num)
: pimpl_(new Pimpl(tab, num)) : pimpl_(new Pimpl(tab, num))
{} {}
LyXLex::~LyXLex() Lexer::~Lexer()
{ {
delete pimpl_; delete pimpl_;
} }
bool LyXLex::isOK() const bool Lexer::isOK() const
{ {
return pimpl_->inputAvailable(); return pimpl_->inputAvailable();
} }
void LyXLex::setLineNo(int l) void Lexer::setLineNo(int l)
{ {
pimpl_->lineno = l; pimpl_->lineno = l;
} }
int LyXLex::getLineNo() const int Lexer::getLineNo() const
{ {
return pimpl_->lineno; return pimpl_->lineno;
} }
istream & LyXLex::getStream() istream & Lexer::getStream()
{ {
return pimpl_->is; return pimpl_->is;
} }
void LyXLex::pushTable(keyword_item * tab, int num) void Lexer::pushTable(keyword_item * tab, int num)
{ {
pimpl_->pushTable(tab, num); pimpl_->pushTable(tab, num);
} }
void LyXLex::popTable() void Lexer::popTable()
{ {
pimpl_->popTable(); pimpl_->popTable();
} }
void LyXLex::printTable(ostream & os) void Lexer::printTable(ostream & os)
{ {
pimpl_->printTable(os); pimpl_->printTable(os);
} }
void LyXLex::printError(string const & message) const void Lexer::printError(string const & message) const
{ {
pimpl_->printError(message); pimpl_->printError(message);
} }
bool LyXLex::setFile(support::FileName const & filename) bool Lexer::setFile(support::FileName const & filename)
{ {
return pimpl_->setFile(filename); return pimpl_->setFile(filename);
} }
void LyXLex::setStream(istream & i) void Lexer::setStream(istream & i)
{ {
pimpl_->setStream(i); pimpl_->setStream(i);
} }
void LyXLex::setCommentChar(char c) void Lexer::setCommentChar(char c)
{ {
pimpl_->setCommentChar(c); pimpl_->setCommentChar(c);
} }
int LyXLex::lex() int Lexer::lex()
{ {
return pimpl_->lex(); return pimpl_->lex();
} }
int LyXLex::getInteger() const int Lexer::getInteger() const
{ {
lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN; lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
if (!lastReadOk_) { if (!lastReadOk_) {
@ -736,7 +736,7 @@ int LyXLex::getInteger() const
} }
double LyXLex::getFloat() const double Lexer::getFloat() const
{ {
// replace comma with dot in case the file was written with // replace comma with dot in case the file was written with
// the wrong locale (should be rare, but is easy enough to // the wrong locale (should be rare, but is easy enough to
@ -757,7 +757,7 @@ double LyXLex::getFloat() const
} }
string const LyXLex::getString() const string const Lexer::getString() const
{ {
lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN; lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
@ -768,7 +768,7 @@ string const LyXLex::getString() const
} }
docstring const LyXLex::getDocString() const docstring const Lexer::getDocString() const
{ {
lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN; lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
@ -782,7 +782,7 @@ docstring const LyXLex::getDocString() const
// I would prefer to give a tag number instead of an explicit token // I would prefer to give a tag number instead of an explicit token
// here, but it is not possible because Buffer::readDocument uses // here, but it is not possible because Buffer::readDocument uses
// explicit tokens (JMarc) // explicit tokens (JMarc)
string const LyXLex::getLongString(string const & endtoken) string const Lexer::getLongString(string const & endtoken)
{ {
string str, prefix; string str, prefix;
bool firstline = true; bool firstline = true;
@ -828,7 +828,7 @@ string const LyXLex::getLongString(string const & endtoken)
} }
bool LyXLex::getBool() const bool Lexer::getBool() const
{ {
if (pimpl_->getString() == "true") { if (pimpl_->getString() == "true") {
lastReadOk_ = true; lastReadOk_ = true;
@ -843,31 +843,31 @@ bool LyXLex::getBool() const
} }
bool LyXLex::eatLine() bool Lexer::eatLine()
{ {
return pimpl_->eatLine(); return pimpl_->eatLine();
} }
bool LyXLex::next(bool esc) bool Lexer::next(bool esc)
{ {
return pimpl_->next(esc); return pimpl_->next(esc);
} }
bool LyXLex::nextToken() bool Lexer::nextToken()
{ {
return pimpl_->nextToken(); return pimpl_->nextToken();
} }
void LyXLex::pushToken(string const & pt) void Lexer::pushToken(string const & pt)
{ {
pimpl_->pushToken(pt); pimpl_->pushToken(pt);
} }
LyXLex::operator void const *() const Lexer::operator void const *() const
{ {
// This behaviour is NOT the same as the std::streams which would // This behaviour is NOT the same as the std::streams which would
// use fail() here. However, our implementation of getString() et al. // use fail() here. However, our implementation of getString() et al.
@ -877,13 +877,13 @@ LyXLex::operator void const *() const
} }
bool LyXLex::operator!() const bool Lexer::operator!() const
{ {
return !lastReadOk_; return !lastReadOk_;
} }
LyXLex & LyXLex::operator>>(std::string & s) Lexer & Lexer::operator>>(std::string & s)
{ {
if (isOK()) { if (isOK()) {
next(); next();
@ -895,7 +895,7 @@ LyXLex & LyXLex::operator>>(std::string & s)
} }
LyXLex & LyXLex::operator>>(docstring & s) Lexer & Lexer::operator>>(docstring & s)
{ {
if (isOK()) { if (isOK()) {
next(); next();
@ -907,7 +907,7 @@ LyXLex & LyXLex::operator>>(docstring & s)
} }
LyXLex & LyXLex::operator>>(double & s) Lexer & Lexer::operator>>(double & s)
{ {
if (isOK()) { if (isOK()) {
next(); next();
@ -919,7 +919,7 @@ LyXLex & LyXLex::operator>>(double & s)
} }
LyXLex & LyXLex::operator>>(int & s) Lexer & Lexer::operator>>(int & s)
{ {
if (isOK()) { if (isOK()) {
next(); next();
@ -931,7 +931,7 @@ LyXLex & LyXLex::operator>>(int & s)
} }
LyXLex & LyXLex::operator>>(unsigned int & s) Lexer & Lexer::operator>>(unsigned int & s)
{ {
if (isOK()) { if (isOK()) {
next(); next();
@ -943,7 +943,7 @@ LyXLex & LyXLex::operator>>(unsigned int & s)
} }
LyXLex & LyXLex::operator>>(bool & s) Lexer & Lexer::operator>>(bool & s)
{ {
if (isOK()) { if (isOK()) {
next(); next();
@ -956,7 +956,7 @@ LyXLex & LyXLex::operator>>(bool & s)
/// quotes a string, e.g. for use in preferences files or as an argument of the "log" dialog /// quotes a string, e.g. for use in preferences files or as an argument of the "log" dialog
string const LyXLex::quoteString(string const & arg) string const Lexer::quoteString(string const & arg)
{ {
std::ostringstream os; std::ostringstream os;
os << '"' << subst(subst(arg, "\\", "\\\\"), "\"", "\\\"") << '"'; os << '"' << subst(subst(arg, "\\", "\\\\"), "\"", "\\\"") << '"';

View File

@ -1,6 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
/** /**
* \file LyXLex.h * \file Lexer.h
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
@ -14,8 +14,8 @@
// It can be used for simple syntax parsers, like lyxrc, // It can be used for simple syntax parsers, like lyxrc,
// texclass and others to come. // texclass and others to come.
#ifndef LYXLEX_H #ifndef LEXER_H
#define LYXLEX_H #define LEXER_H
#include "support/docstring.h" #include "support/docstring.h"
@ -55,12 +55,12 @@ struct keyword_item {
@see LyXRC.cpp for an example of usage. @see LyXRC.cpp for an example of usage.
*/ */
class LyXLex : boost::noncopyable { class Lexer : boost::noncopyable {
public: public:
/// ///
LyXLex(keyword_item *, int); Lexer(keyword_item *, int);
/// ///
~LyXLex(); ~Lexer();
/// Lex basic codes /// Lex basic codes
enum { enum {
@ -158,19 +158,19 @@ public:
void printTable(std::ostream &); void printTable(std::ostream &);
/// extract string /// extract string
LyXLex & operator>>(std::string &); Lexer & operator>>(std::string &);
/// extract docstring /// extract docstring
LyXLex & operator>>(docstring &); Lexer & operator>>(docstring &);
/// extract double /// extract double
LyXLex & operator>>(double &); Lexer & operator>>(double &);
/// extract integer /// extract integer
LyXLex & operator>>(int &); Lexer & operator>>(int &);
/// extract unsigned integer /// extract unsigned integer
LyXLex & operator>>(unsigned int &); Lexer & operator>>(unsigned int &);
/// extract bool /// extract bool
LyXLex & operator>>(bool &); Lexer & operator>>(bool &);
/// Quotes a string so that reading it again with LyXLex::next(true) /// Quotes a string so that reading it again with Lexer::next(true)
/// gets the original string /// gets the original string
static std::string const quoteString(std::string const &); static std::string const quoteString(std::string const &);
@ -189,25 +189,25 @@ private:
exceptions. exceptions.
@author Lgb @author Lgb
*/ */
class pushpophelper { class PushPopHelper {
public: public:
/// ///
pushpophelper(LyXLex & lexrc, keyword_item * i, int s) : lex(lexrc) { PushPopHelper(Lexer & lexrc, keyword_item * i, int s) : lex(lexrc) {
lex.pushTable(i, s); lex.pushTable(i, s);
} }
/// ///
~pushpophelper() { ~PushPopHelper() {
lex.popTable(); lex.popTable();
} }
/// ///
LyXLex & lex; Lexer & lex;
}; };
/** Avoid wrong usage of pushpophelper. /** Avoid wrong usage of PushPopHelper.
To avoid wrong usage: To avoid wrong usage:
pushpophelper(...); // wrong PushPopHelper(...); // wrong
pushpophelper pph(...); // right PushPopHelper pph(...); // right
*/ */
#define pushpophelper(x, y, z) unnamed_pushpophelper; #define PushPopHelper(x, y, z) unnamed_PushPopHelper;
// Tip gotten from Bobby Schmidt's column in C/C++ Users Journal // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal

View File

@ -34,7 +34,7 @@
#include "lyx_cb.h" #include "lyx_cb.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "LyXFunc.h" #include "LyXFunc.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "LyXServer.h" #include "LyXServer.h"
#include "LyXServerSocket.h" #include "LyXServerSocket.h"
@ -1179,7 +1179,7 @@ bool LyX::readUIFile(string const & name, bool include)
LYXERR(Debug::INIT) << "Found " << name LYXERR(Debug::INIT) << "Found " << name
<< " in " << ui_path << endl; << " in " << ui_path << endl;
LyXLex lex(uitags, ui_last - 1); Lexer lex(uitags, ui_last - 1);
lex.setFile(ui_path); lex.setFile(ui_path);
if (!lex.isOK()) { if (!lex.isOK()) {
lyxerr << "Unable to set LyXLeX for ui file: " << ui_path lyxerr << "Unable to set LyXLeX for ui file: " << ui_path

View File

@ -21,7 +21,7 @@
#include "gettext.h" #include "gettext.h"
#include "Language.h" #include "Language.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "support/lstrings.h" #include "support/lstrings.h"
@ -626,7 +626,7 @@ string const LyXFont::latexSize() const
// Read a font definition from given file in lyx format // Read a font definition from given file in lyx format
// Used for layouts // Used for layouts
LyXFont & LyXFont::lyxRead(LyXLex & lex) LyXFont & LyXFont::lyxRead(Lexer & lex)
{ {
bool error = false; bool error = false;
bool finished = false; bool finished = false;

View File

@ -22,7 +22,7 @@
namespace lyx { namespace lyx {
class LyXLex; class Lexer;
class BufferParams; class BufferParams;
class Language; class Language;
@ -288,8 +288,8 @@ public:
/// Is a given font fully resolved? /// Is a given font fully resolved?
bool resolved() const; bool resolved() const;
/// Read a font specification from LyXLex. Used for layout files. /// Read a font specification from Lexer. Used for layout files.
LyXFont & lyxRead(LyXLex &); LyXFont & lyxRead(Lexer &);
/// Writes the changes from this font to orgfont in .lyx format in file /// Writes the changes from this font to orgfont in .lyx format in file
void lyxWriteChanges(LyXFont const & orgfont, std::ostream &) const; void lyxWriteChanges(LyXFont const & orgfont, std::ostream &) const;

View File

@ -50,7 +50,7 @@
#include "lyx_cb.h" #include "lyx_cb.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "lyxfind.h" #include "lyxfind.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "Row.h" #include "Row.h"
#include "LyXServer.h" #include "LyXServer.h"
@ -1271,11 +1271,11 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
data = "literate "; data = "literate ";
break; break;
} }
data += LyXLex::quoteString(logfile.second); data += Lexer::quoteString(logfile.second);
lyx_view_->getDialogs().show("log", data); lyx_view_->getDialogs().show("log", data);
} else if (name == "vclog") { } else if (name == "vclog") {
string const data = "vc " + string const data = "vc " +
LyXLex::quoteString(lyx_view_->buffer()->lyxvc().getLogFile()); Lexer::quoteString(lyx_view_->buffer()->lyxvc().getLogFile());
lyx_view_->getDialogs().show("log", data); lyx_view_->getDialogs().show("log", data);
} else } else
lyx_view_->getDialogs().show(name, data); lyx_view_->getDialogs().show(name, data);
@ -1596,7 +1596,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
Buffer defaults(fname); Buffer defaults(fname);
istringstream ss(argument); istringstream ss(argument);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(ss); lex.setStream(ss);
int const unknown_tokens = defaults.readHeader(lex); int const unknown_tokens = defaults.readHeader(lex);
@ -1621,7 +1621,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
lyx_view_->buffer()->params().getEngine(); lyx_view_->buffer()->params().getEngine();
istringstream ss(argument); istringstream ss(argument);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(ss); lex.setStream(ss);
int const unknown_tokens = int const unknown_tokens =
lyx_view_->buffer()->readHeader(lex); lyx_view_->buffer()->readHeader(lex);

View File

@ -14,7 +14,7 @@
#include "LyXLayout.h" #include "LyXLayout.h"
#include "LyXTextClass.h" #include "LyXTextClass.h"
#include "LyXLex.h" #include "Lexer.h"
#include "debug.h" #include "debug.h"
#include "support/lstrings.h" #include "support/lstrings.h"
@ -132,7 +132,7 @@ LyXLayout::LyXLayout ()
// Reads a layout definition from file // Reads a layout definition from file
bool LyXLayout::read(LyXLex & lexrc, LyXTextClass const & tclass) bool LyXLayout::read(Lexer & lexrc, LyXTextClass const & tclass)
{ {
// This table is sorted alphabetically [asierra 30March96] // This table is sorted alphabetically [asierra 30March96]
keyword_item layoutTags[] = { keyword_item layoutTags[] = {
@ -196,10 +196,10 @@ bool LyXLayout::read(LyXLex & lexrc, LyXTextClass const & tclass)
int le = lexrc.lex(); int le = lexrc.lex();
// See comment in LyXRC.cpp. // See comment in LyXRC.cpp.
switch (le) { switch (le) {
case LyXLex::LEX_FEOF: case Lexer::LEX_FEOF:
continue; continue;
case LyXLex::LEX_UNDEF: // parse error case Lexer::LEX_UNDEF: // parse error
lexrc.printError("Unknown layout tag `$$Token'"); lexrc.printError("Unknown layout tag `$$Token'");
error = true; error = true;
continue; continue;
@ -501,7 +501,7 @@ enum AlignTags {
}; };
void LyXLayout::readAlign(LyXLex & lexrc) void LyXLayout::readAlign(Lexer & lexrc)
{ {
keyword_item alignTags[] = { keyword_item alignTags[] = {
{ "block", AT_BLOCK }, { "block", AT_BLOCK },
@ -511,10 +511,10 @@ void LyXLayout::readAlign(LyXLex & lexrc)
{ "right", AT_RIGHT } { "right", AT_RIGHT }
}; };
pushpophelper pph(lexrc, alignTags, AT_LAYOUT); PushPopHelper pph(lexrc, alignTags, AT_LAYOUT);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown alignment `$$Token'"); lexrc.printError("Unknown alignment `$$Token'");
return; return;
default: break; default: break;
@ -539,7 +539,7 @@ void LyXLayout::readAlign(LyXLex & lexrc)
} }
void LyXLayout::readAlignPossible(LyXLex & lexrc) void LyXLayout::readAlignPossible(Lexer & lexrc)
{ {
keyword_item alignTags[] = { keyword_item alignTags[] = {
{ "block", AT_BLOCK }, { "block", AT_BLOCK },
@ -555,7 +555,7 @@ void LyXLayout::readAlignPossible(LyXLex & lexrc)
do { do {
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown alignment `$$Token'"); lexrc.printError("Unknown alignment `$$Token'");
continue; continue;
default: break; default: break;
@ -596,7 +596,7 @@ enum LabelTypeTags {
}; };
void LyXLayout::readLabelType(LyXLex & lexrc) void LyXLayout::readLabelType(Lexer & lexrc)
{ {
keyword_item labelTypeTags[] = { keyword_item labelTypeTags[] = {
{ "bibliography", LA_BIBLIO }, { "bibliography", LA_BIBLIO },
@ -611,10 +611,10 @@ void LyXLayout::readLabelType(LyXLex & lexrc)
{ "top_environment", LA_TOP_ENVIRONMENT } { "top_environment", LA_TOP_ENVIRONMENT }
}; };
pushpophelper pph(lexrc, labelTypeTags, LA_BIBLIO); PushPopHelper pph(lexrc, labelTypeTags, LA_BIBLIO);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown labeltype tag `$$Token'"); lexrc.printError("Unknown labeltype tag `$$Token'");
return; return;
default: break; default: break;
@ -666,13 +666,13 @@ keyword_item endlabelTypeTags[] = {
} // namespace anon } // namespace anon
void LyXLayout::readEndLabelType(LyXLex & lexrc) void LyXLayout::readEndLabelType(Lexer & lexrc)
{ {
pushpophelper pph(lexrc, endlabelTypeTags, PushPopHelper pph(lexrc, endlabelTypeTags,
END_LABEL_ENUM_LAST-END_LABEL_ENUM_FIRST+1); END_LABEL_ENUM_LAST-END_LABEL_ENUM_FIRST+1);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown labeltype tag `$$Token'"); lexrc.printError("Unknown labeltype tag `$$Token'");
break; break;
case END_LABEL_STATIC: case END_LABEL_STATIC:
@ -689,7 +689,7 @@ void LyXLayout::readEndLabelType(LyXLex & lexrc)
} }
void LyXLayout::readMargin(LyXLex & lexrc) void LyXLayout::readMargin(Lexer & lexrc)
{ {
keyword_item marginTags[] = { keyword_item marginTags[] = {
{ "dynamic", MARGIN_DYNAMIC }, { "dynamic", MARGIN_DYNAMIC },
@ -699,11 +699,11 @@ void LyXLayout::readMargin(LyXLex & lexrc)
{ "static", MARGIN_STATIC } { "static", MARGIN_STATIC }
}; };
pushpophelper pph(lexrc, marginTags, MARGIN_RIGHT_ADDRESS_BOX); PushPopHelper pph(lexrc, marginTags, MARGIN_RIGHT_ADDRESS_BOX);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown margin type tag `$$Token'"); lexrc.printError("Unknown margin type tag `$$Token'");
return; return;
case MARGIN_STATIC: case MARGIN_STATIC:
@ -721,7 +721,7 @@ void LyXLayout::readMargin(LyXLex & lexrc)
} }
void LyXLayout::readLatexType(LyXLex & lexrc) void LyXLayout::readLatexType(Lexer & lexrc)
{ {
keyword_item latexTypeTags[] = { keyword_item latexTypeTags[] = {
{ "bib_environment", LATEX_BIB_ENVIRONMENT }, { "bib_environment", LATEX_BIB_ENVIRONMENT },
@ -732,10 +732,10 @@ void LyXLayout::readLatexType(LyXLex & lexrc)
{ "paragraph", LATEX_PARAGRAPH } { "paragraph", LATEX_PARAGRAPH }
}; };
pushpophelper pph(lexrc, latexTypeTags, LATEX_LIST_ENVIRONMENT); PushPopHelper pph(lexrc, latexTypeTags, LATEX_LIST_ENVIRONMENT);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown latextype tag `$$Token'"); lexrc.printError("Unknown latextype tag `$$Token'");
return; return;
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
@ -762,7 +762,7 @@ enum SpacingTags {
}; };
void LyXLayout::readSpacing(LyXLex & lexrc) void LyXLayout::readSpacing(Lexer & lexrc)
{ {
keyword_item spacingTags[] = { keyword_item spacingTags[] = {
{"double", ST_SPACING_DOUBLE }, {"double", ST_SPACING_DOUBLE },
@ -771,10 +771,10 @@ void LyXLayout::readSpacing(LyXLex & lexrc)
{"single", ST_SPACING_SINGLE } {"single", ST_SPACING_SINGLE }
}; };
pushpophelper pph(lexrc, spacingTags, ST_OTHER); PushPopHelper pph(lexrc, spacingTags, ST_OTHER);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown spacing token `$$Token'"); lexrc.printError("Unknown spacing token `$$Token'");
return; return;
default: break; default: break;

View File

@ -24,7 +24,7 @@
namespace lyx { namespace lyx {
class LyXLex; class Lexer;
class LyXTextClass; class LyXTextClass;
/// ///
@ -33,21 +33,21 @@ public:
/// ///
LyXLayout(); LyXLayout();
/// ///
bool read(LyXLex &, LyXTextClass const &); bool read(Lexer &, LyXTextClass const &);
/// ///
void readAlign(LyXLex &); void readAlign(Lexer &);
/// ///
void readAlignPossible(LyXLex &); void readAlignPossible(Lexer &);
/// ///
void readLabelType(LyXLex &); void readLabelType(Lexer &);
/// ///
void readEndLabelType(LyXLex &); void readEndLabelType(Lexer &);
/// ///
void readMargin(LyXLex &); void readMargin(Lexer &);
/// ///
void readLatexType(LyXLex &); void readLatexType(Lexer &);
/// ///
void readSpacing(LyXLex &); void readSpacing(Lexer &);
/// ///
std::string const & name() const; std::string const & name() const;
/// ///

View File

@ -27,7 +27,7 @@
#include "gettext.h" #include "gettext.h"
#include "Session.h" #include "Session.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXFont.h" #include "LyXFont.h"
#include "Mover.h" #include "Mover.h"
@ -303,7 +303,7 @@ void oldFontFormat(string & family, string & foundry)
int LyXRC::read(FileName const & filename) int LyXRC::read(FileName const & filename)
{ {
LyXLex lexrc(lyxrcTags, lyxrcCount); Lexer lexrc(lyxrcTags, lyxrcCount);
if (lyxerr.debugging(Debug::PARSER)) if (lyxerr.debugging(Debug::PARSER))
lexrc.printTable(lyxerr); lexrc.printTable(lyxerr);
@ -318,7 +318,7 @@ int LyXRC::read(FileName const & filename)
int LyXRC::read(std::istream & is) int LyXRC::read(std::istream & is)
{ {
LyXLex lexrc(lyxrcTags, lyxrcCount); Lexer lexrc(lyxrcTags, lyxrcCount);
if (lyxerr.debugging(Debug::PARSER)) if (lyxerr.debugging(Debug::PARSER))
lexrc.printTable(lyxerr); lexrc.printTable(lyxerr);
@ -331,7 +331,7 @@ int LyXRC::read(std::istream & is)
} }
int LyXRC::read(LyXLex & lexrc) int LyXRC::read(Lexer & lexrc)
{ {
if (!lexrc.isOK()) return -2; if (!lexrc.isOK()) return -2;
@ -339,16 +339,16 @@ int LyXRC::read(LyXLex & lexrc)
// By using two switches we take advantage of the compiler // By using two switches we take advantage of the compiler
// telling us if we have missed a LyXRCTags element in // telling us if we have missed a LyXRCTags element in
// the second switch. // the second switch.
// Note that this also shows a problem with LyXLex since it // Note that this also shows a problem with Lexer since it
// helps us avoid taking advantage of the strictness of the // helps us avoid taking advantage of the strictness of the
// compiler. // compiler.
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown tag `$$Token'"); lexrc.printError("Unknown tag `$$Token'");
continue; continue;
case LyXLex::LEX_FEOF: case Lexer::LEX_FEOF:
continue; continue;
default: break; default: break;
} }
@ -1053,9 +1053,9 @@ int LyXRC::read(LyXLex & lexrc)
// Hack to ensure compatibility with versions older // Hack to ensure compatibility with versions older
// than 1.5.0 // than 1.5.0
int le = lexrc.lex(); int le = lexrc.lex();
if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) { if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
flags = lexrc.getString(); flags = lexrc.getString();
if (le != LyXLex::LEX_DATA) { if (le != Lexer::LEX_DATA) {
// We have got a known token. // We have got a known token.
// Therefore this is an old style // Therefore this is an old style
// format definition without // format definition without

View File

@ -29,7 +29,7 @@ namespace lyx {
namespace support { class FileName; } namespace support { class FileName; }
class LyXLex; class Lexer;
/// This contains the runtime configuration of LyX /// This contains the runtime configuration of LyX
class LyXRC //: public noncopyable class LyXRC //: public noncopyable
@ -155,7 +155,7 @@ public:
int read(std::istream &); int read(std::istream &);
private: private:
/// ///
int read(LyXLex &); int read(Lexer &);
public: public:
/// ///
void write(support::FileName const & filename, void write(support::FileName const & filename,

View File

@ -25,7 +25,7 @@
#include "LCursor.h" #include "LCursor.h"
#include "debug.h" #include "debug.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyXLex.h" #include "Lexer.h"
#include "OutputParams.h" #include "OutputParams.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "paragraph_funcs.h" #include "paragraph_funcs.h"
@ -1342,7 +1342,7 @@ void LyXTabular::write(Buffer const & buf, ostream & os) const
} }
void LyXTabular::read(Buffer const & buf, LyXLex & lex) void LyXTabular::read(Buffer const & buf, Lexer & lex)
{ {
string line; string line;
istream & is = lex.getStream(); istream & is = lex.getStream();

View File

@ -311,7 +311,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const &, LyXLex &); void read(Buffer const &, Lexer &);
/// ///
int latex(Buffer const &, odocstream &, OutputParams const &) const; int latex(Buffer const &, odocstream &, OutputParams const &) const;
// //

View File

@ -334,7 +334,7 @@ public:
/// ///
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// returns whether we've seen our usual 'end' marker /// returns whether we've seen our usual 'end' marker
bool read(Buffer const & buf, LyXLex & lex, ErrorList & errorList); bool read(Buffer const & buf, Lexer & lex, ErrorList & errorList);
/// ///
/// FIXME: move to TextMetrics. /// FIXME: move to TextMetrics.

View File

@ -16,7 +16,7 @@
#include "LyXTextClass.h" #include "LyXTextClass.h"
#include "debug.h" #include "debug.h"
#include "LyXLex.h" #include "Lexer.h"
#include "Counters.h" #include "Counters.h"
#include "Floating.h" #include "Floating.h"
#include "FloatList.h" #include "FloatList.h"
@ -125,7 +125,7 @@ bool LyXTextClass::isTeXClassAvailable() const
} }
bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay) bool LyXTextClass::do_readStyle(Lexer & lexrc, LyXLayout & lay)
{ {
LYXERR(Debug::TCLASS) << "Reading style " << lay.name() << endl; LYXERR(Debug::TCLASS) << "Reading style " << lay.name() << endl;
if (!lay.read(lexrc, *this)) { if (!lay.read(lexrc, *this)) {
@ -214,7 +214,7 @@ bool LyXTextClass::read(FileName const & filename, bool merge)
<< to_utf8(makeDisplayPath(filename.absFilename())) << to_utf8(makeDisplayPath(filename.absFilename()))
<< endl; << endl;
LyXLex lexrc(textClassTags, Lexer lexrc(textClassTags,
sizeof(textClassTags) / sizeof(textClassTags[0])); sizeof(textClassTags) / sizeof(textClassTags[0]));
lexrc.setFile(filename); lexrc.setFile(filename);
@ -228,10 +228,10 @@ bool LyXTextClass::read(FileName const & filename, bool merge)
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_FEOF: case Lexer::LEX_FEOF:
continue; continue;
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown TextClass tag `$$Token'"); lexrc.printError("Unknown TextClass tag `$$Token'");
error = true; error = true;
continue; continue;
@ -476,18 +476,18 @@ bool LyXTextClass::read(FileName const & filename, bool merge)
} }
void LyXTextClass::readTitleType(LyXLex & lexrc) void LyXTextClass::readTitleType(Lexer & lexrc)
{ {
keyword_item titleTypeTags[] = { keyword_item titleTypeTags[] = {
{ "commandafter", TITLE_COMMAND_AFTER }, { "commandafter", TITLE_COMMAND_AFTER },
{ "environment", TITLE_ENVIRONMENT } { "environment", TITLE_ENVIRONMENT }
}; };
pushpophelper pph(lexrc, titleTypeTags, TITLE_ENVIRONMENT); PushPopHelper pph(lexrc, titleTypeTags, TITLE_ENVIRONMENT);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown output type `$$Token'"); lexrc.printError("Unknown output type `$$Token'");
return; return;
case TITLE_COMMAND_AFTER: case TITLE_COMMAND_AFTER:
@ -503,7 +503,7 @@ void LyXTextClass::readTitleType(LyXLex & lexrc)
} }
void LyXTextClass::readOutputType(LyXLex & lexrc) void LyXTextClass::readOutputType(Lexer & lexrc)
{ {
keyword_item outputTypeTags[] = { keyword_item outputTypeTags[] = {
{ "docbook", DOCBOOK }, { "docbook", DOCBOOK },
@ -511,11 +511,11 @@ void LyXTextClass::readOutputType(LyXLex & lexrc)
{ "literate", LITERATE } { "literate", LITERATE }
}; };
pushpophelper pph(lexrc, outputTypeTags, LITERATE); PushPopHelper pph(lexrc, outputTypeTags, LITERATE);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown output type `$$Token'"); lexrc.printError("Unknown output type `$$Token'");
return; return;
case LATEX: case LATEX:
@ -541,7 +541,7 @@ enum ClassOptionsTags {
}; };
void LyXTextClass::readClassOptions(LyXLex & lexrc) void LyXTextClass::readClassOptions(Lexer & lexrc)
{ {
keyword_item classOptionsTags[] = { keyword_item classOptionsTags[] = {
{"end", CO_END }, {"end", CO_END },
@ -556,7 +556,7 @@ void LyXTextClass::readClassOptions(LyXLex & lexrc)
while (!getout && lexrc.isOK()) { while (!getout && lexrc.isOK()) {
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown ClassOption tag `$$Token'"); lexrc.printError("Unknown ClassOption tag `$$Token'");
continue; continue;
default: break; default: break;
@ -597,7 +597,7 @@ enum CharStyleTags {
}; };
void LyXTextClass::readCharStyle(LyXLex & lexrc, string const & name) void LyXTextClass::readCharStyle(Lexer & lexrc, string const & name)
{ {
keyword_item elementTags[] = { keyword_item elementTags[] = {
{ "end", CS_END }, { "end", CS_END },
@ -622,7 +622,7 @@ void LyXTextClass::readCharStyle(LyXLex & lexrc, string const & name)
while (!getout && lexrc.isOK()) { while (!getout && lexrc.isOK()) {
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown ClassOption tag `$$Token'"); lexrc.printError("Unknown ClassOption tag `$$Token'");
continue; continue;
default: break; default: break;
@ -687,7 +687,7 @@ enum FloatTags {
}; };
void LyXTextClass::readFloat(LyXLex & lexrc) void LyXTextClass::readFloat(Lexer & lexrc)
{ {
keyword_item floatTags[] = { keyword_item floatTags[] = {
{ "end", FT_END }, { "end", FT_END },
@ -716,7 +716,7 @@ void LyXTextClass::readFloat(LyXLex & lexrc)
while (!getout && lexrc.isOK()) { while (!getout && lexrc.isOK()) {
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown ClassOption tag `$$Token'"); lexrc.printError("Unknown ClassOption tag `$$Token'");
continue; continue;
default: break; default: break;
@ -781,7 +781,7 @@ enum CounterTags {
CT_END CT_END
}; };
void LyXTextClass::readCounter(LyXLex & lexrc) void LyXTextClass::readCounter(Lexer & lexrc)
{ {
keyword_item counterTags[] = { keyword_item counterTags[] = {
{ "end", CT_END }, { "end", CT_END },
@ -798,7 +798,7 @@ void LyXTextClass::readCounter(LyXLex & lexrc)
while (!getout && lexrc.isOK()) { while (!getout && lexrc.isOK()) {
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown ClassOption tag `$$Token'"); lexrc.printError("Unknown ClassOption tag `$$Token'");
continue; continue;
default: break; default: break;

View File

@ -22,7 +22,7 @@ namespace lyx {
namespace support { class FileName; } namespace support { class FileName; }
class LyXLex; class Lexer;
class Counters; class Counters;
class FloatList; class FloatList;
@ -69,19 +69,19 @@ public:
/// Performs the read of the layout file. /// Performs the read of the layout file.
bool read(support::FileName const & filename, bool merge = false); bool read(support::FileName const & filename, bool merge = false);
/// ///
void readOutputType(LyXLex &); void readOutputType(Lexer &);
/// ///
void readTitleType(LyXLex &); void readTitleType(Lexer &);
/// ///
void readMaxCounter(LyXLex &); void readMaxCounter(Lexer &);
/// ///
void readClassOptions(LyXLex &); void readClassOptions(Lexer &);
/// ///
void readCharStyle(LyXLex &, std::string const &); void readCharStyle(Lexer &, std::string const &);
/// ///
void readFloat(LyXLex &); void readFloat(Lexer &);
/// ///
void readCounter(LyXLex &); void readCounter(Lexer &);
/// ///
bool hasLayout(std::string const & name) const; bool hasLayout(std::string const & name) const;
@ -174,7 +174,7 @@ private:
/// ///
bool delete_layout(std::string const &); bool delete_layout(std::string const &);
/// ///
bool do_readStyle(LyXLex &, LyXLayout &); bool do_readStyle(Lexer &, LyXLayout &);
/// Layout file name /// Layout file name
std::string name_; std::string name_;
/// document class name /// document class name

View File

@ -14,7 +14,7 @@
#include "LyXTextClassList.h" #include "LyXTextClassList.h"
#include "LyXTextClass.h" #include "LyXTextClass.h"
#include "debug.h" #include "debug.h"
#include "LyXLex.h" #include "Lexer.h"
#include "support/filetools.h" #include "support/filetools.h"
@ -96,7 +96,7 @@ public:
// Reads LyX textclass definitions according to textclass config file // Reads LyX textclass definitions according to textclass config file
bool LyXTextClassList::read() bool LyXTextClassList::read()
{ {
LyXLex lex(0, 0); Lexer lex(0, 0);
support::FileName const real_file = libFileSearch("", "textclass.lst"); support::FileName const real_file = libFileSearch("", "textclass.lst");
LYXERR(Debug::TCLASS) << "Reading textclasses from `" LYXERR(Debug::TCLASS) << "Reading textclasses from `"
<< real_file << '\'' << endl; << real_file << '\'' << endl;
@ -135,7 +135,7 @@ bool LyXTextClassList::read()
while (lex.isOK() && !finished) { while (lex.isOK() && !finished) {
LYXERR(Debug::TCLASS) << "\tline by line" << endl; LYXERR(Debug::TCLASS) << "\tline by line" << endl;
switch (lex.lex()) { switch (lex.lex()) {
case LyXLex::LEX_FEOF: case Lexer::LEX_FEOF:
finished = true; finished = true;
break; break;
default: default:

View File

@ -181,6 +181,8 @@ lyx_SOURCES = \
layout.h \ layout.h \
lengthcommon.cpp \ lengthcommon.cpp \
lengthcommon.h \ lengthcommon.h \
Lexer.cpp \
Lexer.h \
lfuns.h \ lfuns.h \
lyx_cb.cpp \ lyx_cb.cpp \
lyx_cb.h \ lyx_cb.h \
@ -201,8 +203,6 @@ lyx_SOURCES = \
lyxlayout_ptr_fwd.h \ lyxlayout_ptr_fwd.h \
LyXLength.cpp \ LyXLength.cpp \
LyXLength.h \ LyXLength.h \
LyXLex.cpp \
LyXLex.h \
LyXRC.cpp \ LyXRC.cpp \
LyXRC.h \ LyXRC.h \
Row.cpp \ Row.cpp \

View File

@ -34,7 +34,7 @@
#include "LyXAction.h" #include "LyXAction.h"
#include "LyX.h" // for lastfiles #include "LyX.h" // for lastfiles
#include "LyXFunc.h" #include "LyXFunc.h"
#include "LyXLex.h" #include "Lexer.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "TocBackend.h" #include "TocBackend.h"
#include "ToolbarBackend.h" #include "ToolbarBackend.h"
@ -210,7 +210,7 @@ Menu & Menu::addWithStatusCheck(MenuItem const & i)
} }
Menu & Menu::read(LyXLex & lex) Menu & Menu::read(Lexer & lex)
{ {
enum Menutags { enum Menutags {
md_item = 1, md_item = 1,
@ -904,7 +904,7 @@ void MenuBackend::expand(Menu const & frommenu, Menu & tomenu,
} }
void MenuBackend::read(LyXLex & lex) void MenuBackend::read(Lexer & lex)
{ {
enum Menutags { enum Menutags {
md_menu = 1, md_menu = 1,

View File

@ -23,7 +23,7 @@
namespace lyx { namespace lyx {
class LyXLex; class Lexer;
class Buffer; class Buffer;
class Menu; class Menu;
@ -161,7 +161,7 @@ public:
/// menu item. /// menu item.
Menu & addWithStatusCheck(MenuItem const &); Menu & addWithStatusCheck(MenuItem const &);
/// ///
Menu & read(LyXLex &); Menu & read(Lexer &);
/// ///
docstring const & name() const { return name_; } docstring const & name() const { return name_; }
/// ///
@ -207,7 +207,7 @@ public:
/// ///
MenuBackend() {} MenuBackend() {}
/// ///
void read(LyXLex &); void read(Lexer &);
/// ///
void add(Menu const &); void add(Menu const &);
/// ///

View File

@ -19,7 +19,7 @@
#include "Buffer.h" #include "Buffer.h"
#include "gettext.h" #include "gettext.h"
#include "LyXLayout.h" #include "LyXLayout.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXText.h" #include "LyXText.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "tex-strings.h" #include "tex-strings.h"
@ -176,7 +176,7 @@ void ParagraphParameters::leftIndent(LyXLength const & li)
} }
void ParagraphParameters::read(LyXLex & lex) void ParagraphParameters::read(Lexer & lex)
{ {
while (lex.isOK()) { while (lex.isOK()) {
lex.nextToken(); lex.nextToken();

View File

@ -29,7 +29,7 @@ namespace lyx {
class BufferView; class BufferView;
class LyXLength; class LyXLength;
class LyXLex; class Lexer;
class Paragraph; class Paragraph;
class Spacing; class Spacing;
@ -81,7 +81,7 @@ public:
void leftIndent(LyXLength const &); void leftIndent(LyXLength const &);
/// read the parameters from a lex /// read the parameters from a lex
void read(LyXLex & lex); void read(Lexer & lex);
/// write out the parameters to a stream /// write out the parameters to a stream
void write(std::ostream & os) const; void write(std::ostream & os) const;

View File

@ -13,7 +13,7 @@
#include "ToolbarBackend.h" #include "ToolbarBackend.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "LyXLex.h" #include "Lexer.h"
#include "debug.h" #include "debug.h"
#include "gettext.h" #include "gettext.h"
#include "LyXAction.h" #include "LyXAction.h"
@ -79,7 +79,7 @@ void ToolbarInfo::add(ToolbarItem const & item)
} }
ToolbarInfo & ToolbarInfo::read(LyXLex & lex) ToolbarInfo & ToolbarInfo::read(Lexer & lex)
{ {
enum tooltags { enum tooltags {
TO_COMMAND = 1, TO_COMMAND = 1,
@ -208,7 +208,7 @@ ToolbarBackend::ToolbarBackend()
} }
void ToolbarBackend::readToolbars(LyXLex & lex) void ToolbarBackend::readToolbars(Lexer & lex)
{ {
enum tooltags { enum tooltags {
TO_TOOLBAR = 1, TO_TOOLBAR = 1,
@ -255,7 +255,7 @@ void ToolbarBackend::readToolbars(LyXLex & lex)
} }
void ToolbarBackend::readToolbarSettings(LyXLex & lex) void ToolbarBackend::readToolbarSettings(Lexer & lex)
{ {
//consistency check //consistency check
if (compare_ascii_no_case(lex.getString(), "toolbars")) { if (compare_ascii_no_case(lex.getString(), "toolbars")) {

View File

@ -21,7 +21,7 @@
namespace lyx { namespace lyx {
class LyXLex; class Lexer;
class ToolbarItem { class ToolbarItem {
public: public:
@ -97,7 +97,7 @@ public:
Flags flags; Flags flags;
/// read a toolbar from the file /// read a toolbar from the file
ToolbarInfo & read(LyXLex &); ToolbarInfo & read(Lexer &);
private: private:
/// add toolbar item /// add toolbar item
@ -122,10 +122,10 @@ public:
Toolbars::iterator end() { return usedtoolbars.end(); } Toolbars::iterator end() { return usedtoolbars.end(); }
/// read toolbars from the file /// read toolbars from the file
void readToolbars(LyXLex &); void readToolbars(Lexer &);
/// read ui toolbar settings /// read ui toolbar settings
void readToolbarSettings(LyXLex &); void readToolbarSettings(Lexer &);
/// ///
ToolbarInfo const & getToolbar(std::string const & name) const; ToolbarInfo const & getToolbar(std::string const & name) const;
/// ///

View File

@ -14,7 +14,7 @@
#include "Trans.h" #include "Trans.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "LyXLex.h" #include "Lexer.h"
#include "debug.h" #include "debug.h"
#include "TransState.h" #include "TransState.h"
@ -126,7 +126,7 @@ void Trans::addDeadkey(tex_accent accent, docstring const & keys)
} }
int Trans::load(LyXLex & lex) int Trans::load(Lexer & lex)
{ {
bool error = false; bool error = false;
@ -281,7 +281,7 @@ int Trans::load(LyXLex & lex)
key, str); key, str);
break; break;
} }
case LyXLex::LEX_FEOF: case Lexer::LEX_FEOF:
LYXERR(Debug::PARSER) << "End of parsing" << endl; LYXERR(Debug::PARSER) << "End of parsing" << endl;
break; break;
default: default:
@ -328,7 +328,7 @@ int Trans::load(string const & language)
return -1; return -1;
freeKeymap(); freeKeymap();
LyXLex lex(kmapTags, K_LAST - 1); Lexer lex(kmapTags, K_LAST - 1);
lex.setFile(filename); lex.setFile(filename);
int const res = load(lex); int const res = load(lex);

View File

@ -22,7 +22,7 @@
namespace lyx { namespace lyx {
class LyXLex; class Lexer;
class TransManager; class TransManager;
@ -53,7 +53,7 @@ private:
/// ///
void freeKeymap(); void freeKeymap();
/// ///
int load(LyXLex &); int load(Lexer &);
/// ///
docstring const & match(char_type c); docstring const & match(char_type c);
/// ///

View File

@ -25,7 +25,7 @@
#include "gettext.h" #include "gettext.h"
#include "Language.h" #include "Language.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "Row.h" #include "Row.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "ParagraphParameters.h" #include "ParagraphParameters.h"
@ -84,7 +84,7 @@ bool font2string(LyXFont const & font, bool const toggle, string & data)
bool string2font(string const & data, LyXFont & font, bool & toggle) bool string2font(string const & data, LyXFont & font, bool & toggle)
{ {
istringstream is(data); istringstream is(data);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(is); lex.setStream(is);
int nset = 0; int nset = 0;

View File

@ -19,7 +19,7 @@
#include "FloatList.h" #include "FloatList.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyX.h" #include "LyX.h"
#include "Paragraph.h" #include "Paragraph.h"
@ -372,7 +372,7 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
} }
InsetBase * readInset(LyXLex & lex, Buffer const & buf) InsetBase * readInset(Lexer & lex, Buffer const & buf)
{ {
// consistency check // consistency check
if (lex.getString() != "\\begin_inset") { if (lex.getString() != "\\begin_inset") {

View File

@ -18,14 +18,14 @@ class Buffer;
class BufferView; class BufferView;
class FuncRequest; class FuncRequest;
class InsetBase; class InsetBase;
class LyXLex; class Lexer;
/// creates inset according to 'cmd' /// creates inset according to 'cmd'
InsetBase * createInset(BufferView * bv, FuncRequest const & cmd); InsetBase * createInset(BufferView * bv, FuncRequest const & cmd);
/// read inset from a file /// read inset from a file
InsetBase * readInset(LyXLex & lex, Buffer const & buf); InsetBase * readInset(Lexer & lex, Buffer const & buf);
} // namespace lyx } // namespace lyx

View File

@ -14,7 +14,7 @@
#include "ControlLog.h" #include "ControlLog.h"
#include "gettext.h" #include "gettext.h"
#include "LyXLex.h" #include "Lexer.h"
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
@ -38,7 +38,7 @@ ControlLog::ControlLog(Dialog & parent)
bool ControlLog::initialiseParams(string const & data) bool ControlLog::initialiseParams(string const & data)
{ {
istringstream is(data); istringstream is(data);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(is); lex.setStream(is);
string logtype, logfile; string logtype, logfile;

View File

@ -14,7 +14,7 @@
#include "ControlParagraph.h" #include "ControlParagraph.h"
#include "ButtonController.h" #include "ButtonController.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "LyXLex.h" #include "Lexer.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "ParagraphParameters.h" #include "ParagraphParameters.h"
@ -35,7 +35,7 @@ ControlParagraph::ControlParagraph(Dialog & parent)
bool ControlParagraph::initialiseParams(string const & data) bool ControlParagraph::initialiseParams(string const & data)
{ {
istringstream is(data); istringstream is(data);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(is); lex.setStream(is);
// Set tri-state flag: // Set tri-state flag:

View File

@ -3003,7 +3003,7 @@
* insetbibtex.[Ch] (clone): move out of line; use copy c-tor. * insetbibtex.[Ch] (clone): move out of line; use copy c-tor.
* insetexternal.C (read): use pushpophelper. * insetexternal.C (read): use PushPopHelper.
2003-07-28 José Matos <jamatos@lyx.org> 2003-07-28 José Matos <jamatos@lyx.org>
@ -3419,7 +3419,7 @@
* insetexternal.h: remove Params::parameters variable. * insetexternal.h: remove Params::parameters variable.
* insetexternal.C (read, write): rewrite to output new ExternalInset * insetexternal.C (read, write): rewrite to output new ExternalInset
format and read it back making full use of LyXLex. format and read it back making full use of Lexer.
2003-06-04 André Pönitz <poenitz@gmx.net> 2003-06-04 André Pönitz <poenitz@gmx.net>

View File

@ -14,7 +14,7 @@
#include "ExternalTemplate.h" #include "ExternalTemplate.h"
#include "debug.h" #include "debug.h"
#include "LyXLex.h" #include "Lexer.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lstrings.h" #include "support/lstrings.h"
@ -251,7 +251,7 @@ void TemplateManager::readTemplates(support::FileName const & path)
{ "templateend", TM_TEMPLATE_END } { "templateend", TM_TEMPLATE_END }
}; };
LyXLex lex(templatetags, TM_TEMPLATE_END); Lexer lex(templatetags, TM_TEMPLATE_END);
support::FileName const filename = support::libFileSearch("", "external_templates"); support::FileName const filename = support::libFileSearch("", "external_templates");
if (filename.empty() || !lex.setFile(filename)) { if (filename.empty() || !lex.setFile(filename)) {
@ -310,7 +310,7 @@ void add(vector<TransformID> & ids, string const & name)
} // namespace anon } // namespace anon
void Template::readTemplate(LyXLex & lex) void Template::readTemplate(Lexer & lex)
{ {
enum TemplateOptionTags { enum TemplateOptionTags {
TO_GUINAME = 1, TO_GUINAME = 1,
@ -334,7 +334,7 @@ void Template::readTemplate(LyXLex & lex)
{ "transform", TO_TRANSFORM } { "transform", TO_TRANSFORM }
}; };
pushpophelper pph(lex, templateoptiontags, TO_END); PushPopHelper pph(lex, templateoptiontags, TO_END);
while (lex.isOK()) { while (lex.isOK()) {
switch (lex.lex()) { switch (lex.lex()) {
@ -466,7 +466,7 @@ void setOptionFactory(Template::Format & format, string const & transform,
} // namespace anon } // namespace anon
void Template::Format::readFormat(LyXLex & lex) void Template::Format::readFormat(Lexer & lex)
{ {
enum FormatTags { enum FormatTags {
FO_PRODUCT = 1, FO_PRODUCT = 1,
@ -494,7 +494,7 @@ void Template::Format::readFormat(LyXLex & lex)
{ "updateresult", FO_UPDATERESULT } { "updateresult", FO_UPDATERESULT }
}; };
pushpophelper pph(lex, formattags, FO_END); PushPopHelper pph(lex, formattags, FO_END);
while (lex.isOK()) { while (lex.isOK()) {
switch (lex.lex()) { switch (lex.lex()) {

View File

@ -21,7 +21,7 @@ namespace lyx {
namespace support { class FileName; } namespace support { class FileName; }
class LyXLex; class Lexer;
namespace external { namespace external {
@ -30,7 +30,7 @@ public:
/// We have to have default commands for safety reasons! /// We have to have default commands for safety reasons!
Template(); Template();
/// ///
void readTemplate(LyXLex &); void readTemplate(Lexer &);
/// ///
void dumpFormats(std::ostream &) const; void dumpFormats(std::ostream &) const;
@ -64,7 +64,7 @@ public:
public: public:
Format(); Format();
/// ///
void readFormat(LyXLex &); void readFormat(Lexer &);
/// The text that should be inserted into the exported file /// The text that should be inserted into the exported file
std::string product; std::string product;

View File

@ -25,7 +25,7 @@
namespace lyx { namespace lyx {
class LyXLex; class Lexer;
namespace external { namespace external {

View File

@ -33,7 +33,7 @@ class InsetText;
class LaTeXFeatures; class LaTeXFeatures;
class LColor_color; class LColor_color;
class LCursor; class LCursor;
class LyXLex; class Lexer;
class LyXText; class LyXText;
class MetricsInfo; class MetricsInfo;
class Dimension; class Dimension;
@ -383,7 +383,7 @@ public:
/// write inset in .lyx format /// write inset in .lyx format
virtual void write(Buffer const &, std::ostream &) const {} virtual void write(Buffer const &, std::ostream &) const {}
/// read inset in .lyx format /// read inset in .lyx format
virtual void read(Buffer const &, LyXLex &) {} virtual void read(Buffer const &, Lexer &) {}
/** Export the inset to LaTeX. /** Export the inset to LaTeX.
* Don't use a temporary stringstream if the final output is * Don't use a temporary stringstream if the final output is
* supposed to go to a file. * supposed to go to a file.

View File

@ -17,7 +17,7 @@
#include "DispatchResult.h" #include "DispatchResult.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "LyXFont.h" #include "LyXFont.h"
#include "LyXLex.h" #include "Lexer.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "ParagraphList.h" #include "ParagraphList.h"
@ -84,7 +84,7 @@ void InsetBibitem::setCounter(int c)
} }
void InsetBibitem::read(Buffer const & buf, LyXLex & lex) void InsetBibitem::read(Buffer const & buf, Lexer & lex)
{ {
InsetCommand::read(buf, lex); InsetCommand::read(buf, lex);

View File

@ -28,7 +28,7 @@ public:
/// ///
InsetBibitem(InsetCommandParams const &); InsetBibitem(InsetCommandParams const &);
/// ///
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, Lexer & lex);
/// ///
docstring const getScreenLabel(Buffer const &) const; docstring const getScreenLabel(Buffer const &) const;
/// ///

View File

@ -23,7 +23,7 @@
#include "gettext.h" #include "gettext.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "TextMetrics.h" #include "TextMetrics.h"
@ -134,7 +134,7 @@ void InsetBox::write(Buffer const & buf, ostream & os) const
} }
void InsetBox::read(Buffer const & buf, LyXLex & lex) void InsetBox::read(Buffer const & buf, Lexer & lex)
{ {
params_.read(lex); params_.read(lex);
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
@ -485,7 +485,7 @@ void InsetBoxMailer::string2params(string const & in,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;
@ -533,7 +533,7 @@ void InsetBoxParams::write(ostream & os) const
} }
void InsetBoxParams::read(LyXLex & lex) void InsetBoxParams::read(Lexer & lex)
{ {
if (!lex.isOK()) if (!lex.isOK())
return; return;

View File

@ -27,7 +27,7 @@ public:
/// ///
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
void read(LyXLex & lex); void read(Lexer & lex);
/// ///
std::string type; std::string type;
/// Use a parbox (true) or minipage (false) /// Use a parbox (true) or minipage (false)
@ -68,7 +68,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
void setButtonLabel(); void setButtonLabel();
/// ///

View File

@ -21,7 +21,7 @@
#include "FuncStatus.h" #include "FuncStatus.h"
#include "gettext.h" #include "gettext.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "OutputParams.h" #include "OutputParams.h"
@ -84,7 +84,7 @@ void InsetBranch::write(Buffer const & buf, ostream & os) const
} }
void InsetBranch::read(Buffer const & buf, LyXLex & lex) void InsetBranch::read(Buffer const & buf, Lexer & lex)
{ {
params_.read(lex); params_.read(lex);
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
@ -296,7 +296,7 @@ void InsetBranchMailer::string2params(string const & in,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;
@ -321,7 +321,7 @@ void InsetBranchParams::write(ostream & os) const
} }
void InsetBranchParams::read(LyXLex & lex) void InsetBranchParams::read(Lexer & lex)
{ {
lex >> branch; lex >> branch;
} }

View File

@ -27,7 +27,7 @@ public:
/// ///
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
void read(LyXLex & lex); void read(Lexer & lex);
/// ///
docstring branch; docstring branch;
}; };
@ -49,7 +49,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
void setButtonLabel(); void setButtonLabel();
/// ///

View File

@ -67,7 +67,7 @@ void InsetCaption::write(Buffer const & buf, ostream & os) const
} }
void InsetCaption::read(Buffer const & buf, LyXLex & lex) void InsetCaption::read(Buffer const & buf, Lexer & lex)
{ {
#if 0 #if 0
// We will enably this check again when the compability // We will enably this check again when the compability

View File

@ -29,7 +29,7 @@ public:
/// ///
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
virtual bool display() const; virtual bool display() const;
/// ///

View File

@ -24,7 +24,7 @@
#include "gettext.h" #include "gettext.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXText.h" #include "LyXText.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "Paragraph.h" #include "Paragraph.h"
@ -131,7 +131,7 @@ void InsetCharStyle::write(Buffer const & buf, ostream & os) const
} }
void InsetCharStyle::read(Buffer const & buf, LyXLex & lex) void InsetCharStyle::read(Buffer const & buf, Lexer & lex)
{ {
params_.read(lex); params_.read(lex);
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
@ -353,7 +353,7 @@ void InsetCharStyleParams::write(ostream & os) const
} }
void InsetCharStyleParams::read(LyXLex & lex) void InsetCharStyleParams::read(Lexer & lex)
{ {
while (lex.isOK()) { while (lex.isOK()) {
lex.next(); lex.next();

View File

@ -25,7 +25,7 @@ public:
/// ///
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
void read(LyXLex & lex); void read(Lexer & lex);
/// ///
std::string type; std::string type;
/// ///
@ -66,7 +66,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
bool metrics(MetricsInfo &, Dimension &) const; bool metrics(MetricsInfo &, Dimension &) const;
/// ///

View File

@ -24,7 +24,7 @@
#include "FuncStatus.h" #include "FuncStatus.h"
#include "gettext.h" #include "gettext.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "Paragraph.h" #include "Paragraph.h"
@ -99,7 +99,7 @@ void InsetCollapsable::write(Buffer const & buf, ostream & os) const
} }
void InsetCollapsable::read(Buffer const & buf, LyXLex & lex) void InsetCollapsable::read(Buffer const & buf, Lexer & lex)
{ {
bool token_found = false; bool token_found = false;
if (lex.isOK()) { if (lex.isOK()) {

View File

@ -44,7 +44,7 @@ public:
/// ///
InsetCollapsable(InsetCollapsable const & rhs); InsetCollapsable(InsetCollapsable const & rhs);
/// ///
void read(Buffer const &, LyXLex &); void read(Buffer const &, Lexer &);
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///

View File

@ -18,7 +18,7 @@
#include "FuncRequest.h" #include "FuncRequest.h"
#include "FuncStatus.h" #include "FuncStatus.h"
#include "gettext.h" #include "gettext.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include <sstream> #include <sstream>
@ -193,7 +193,7 @@ void InsetCommandMailer::string2params(string const & name,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string n; string n;

View File

@ -45,7 +45,7 @@ public:
void write(Buffer const &, std::ostream & os) const void write(Buffer const &, std::ostream & os) const
{ p_.write(os); } { p_.write(os); }
/// ///
virtual void read(Buffer const &, LyXLex & lex) virtual void read(Buffer const &, Lexer & lex)
{ p_.read(lex); } { p_.read(lex); }
/// ///
int latex(Buffer const &, odocstream &, OutputParams const &) const; int latex(Buffer const &, odocstream &, OutputParams const &) const;

View File

@ -15,7 +15,7 @@
#include "debug.h" #include "debug.h"
#include "gettext.h" #include "gettext.h"
#include "LyXLex.h" #include "Lexer.h"
#include "support/ExceptionMessage.h" #include "support/ExceptionMessage.h"
#include "support/lstrings.h" #include "support/lstrings.h"
@ -256,7 +256,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
} }
void InsetCommandParams::read(LyXLex & lex) void InsetCommandParams::read(Lexer & lex)
{ {
if (lex.isOK()) { if (lex.isOK()) {
lex.next(); lex.next();
@ -310,7 +310,7 @@ void InsetCommandParams::write(ostream & os) const
if (!params_[i].empty()) if (!params_[i].empty())
// FIXME UNICODE // FIXME UNICODE
os << info_->paramnames[i] << ' ' os << info_->paramnames[i] << ' '
<< LyXLex::quoteString(to_utf8(params_[i])) << Lexer::quoteString(to_utf8(params_[i]))
<< '\n'; << '\n';
} }

View File

@ -21,14 +21,14 @@
namespace lyx { namespace lyx {
class LyXLex; class Lexer;
class InsetCommandParams { class InsetCommandParams {
public: public:
/// Construct parameters for command \p name. \p name must be known. /// Construct parameters for command \p name. \p name must be known.
explicit InsetCommandParams(std::string const & name); explicit InsetCommandParams(std::string const & name);
/// ///
void read(LyXLex &); void read(Lexer &);
/// Parse the command /// Parse the command
/// FIXME remove /// FIXME remove
void scanCommand(std::string const &); void scanCommand(std::string const &);

View File

@ -25,7 +25,7 @@
#include "Language.h" #include "Language.h"
#include "LColor.h" #include "LColor.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXTextClass.h" #include "LyXTextClass.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "ParagraphParameters.h" #include "ParagraphParameters.h"
@ -114,7 +114,7 @@ void InsetERT::write(Buffer const & buf, ostream & os) const
} }
void InsetERT::read(Buffer const & buf, LyXLex & lex) void InsetERT::read(Buffer const & buf, Lexer & lex)
{ {
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
@ -456,7 +456,7 @@ void InsetERTMailer::string2params(string const & in,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;

View File

@ -46,7 +46,7 @@ public:
/// ///
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
virtual docstring const editMessage() const; virtual docstring const editMessage() const;
/// ///

View File

@ -55,7 +55,7 @@ void InsetEnvironment::write(Buffer const & buf, ostream & os) const
} }
void InsetEnvironment::read(Buffer const & buf, LyXLex & lex) void InsetEnvironment::read(Buffer const & buf, Lexer & lex)
{ {
InsetText::read(buf, lex); InsetText::read(buf, lex);
} }

View File

@ -25,7 +25,7 @@ public:
/// ///
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
InsetBase::Code lyxCode() const { return InsetBase::ENVIRONMENT_CODE; } InsetBase::Code lyxCode() const { return InsetBase::ENVIRONMENT_CODE; }
/// ///

View File

@ -27,7 +27,7 @@
#include "gettext.h" #include "gettext.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyX.h" #include "LyX.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "OutputParams.h" #include "OutputParams.h"
@ -239,7 +239,7 @@ void InsetExternalParams::write(Buffer const & buffer, ostream & os) const
} }
bool InsetExternalParams::read(Buffer const & buffer, LyXLex & lex) bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex)
{ {
enum ExternalTags { enum ExternalTags {
EX_TEMPLATE = 1, EX_TEMPLATE = 1,
@ -277,7 +277,7 @@ bool InsetExternalParams::read(Buffer const & buffer, LyXLex & lex)
{ "width", EX_WIDTH } { "width", EX_WIDTH }
}; };
pushpophelper pph(lex, external_tags, EX_END); PushPopHelper pph(lex, external_tags, EX_END);
bool found_end = false; bool found_end = false;
bool read_error = false; bool read_error = false;
@ -665,7 +665,7 @@ void InsetExternal::write(Buffer const & buffer, ostream & os) const
} }
void InsetExternal::read(Buffer const & buffer, LyXLex & lex) void InsetExternal::read(Buffer const & buffer, Lexer & lex)
{ {
InsetExternalParams params; InsetExternalParams params;
if (params.read(buffer, lex)) if (params.read(buffer, lex))
@ -868,7 +868,7 @@ void InsetExternalMailer::string2params(string const & in,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;

View File

@ -69,7 +69,7 @@ public:
InsetExternalParams(); InsetExternalParams();
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
bool read(Buffer const &, LyXLex &); bool read(Buffer const &, Lexer &);
/// The name of the tempfile used for manipulations. /// The name of the tempfile used for manipulations.
support::FileName const & tempname() const { return tempname_(); } support::FileName const & tempname() const { return tempname_(); }
@ -122,7 +122,7 @@ public:
/// ///
virtual void write(Buffer const &, std::ostream &) const; virtual void write(Buffer const &, std::ostream &) const;
/// ///
virtual void read(Buffer const &, LyXLex & lex); virtual void read(Buffer const &, Lexer & lex);
/// \returns the number of rows (\n's) of generated code. /// \returns the number of rows (\n's) of generated code.
int latex(Buffer const &, odocstream &, int latex(Buffer const &, odocstream &,

View File

@ -26,7 +26,7 @@
#include "gettext.h" #include "gettext.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "OutputParams.h" #include "OutputParams.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "TocBackend.h" #include "TocBackend.h"
@ -206,7 +206,7 @@ void InsetFloatParams::write(ostream & os) const
} }
void InsetFloatParams::read(LyXLex & lex) void InsetFloatParams::read(Lexer & lex)
{ {
string token; string token;
lex >> token; lex >> token;
@ -244,7 +244,7 @@ void InsetFloat::write(Buffer const & buf, ostream & os) const
} }
void InsetFloat::read(Buffer const & buf, LyXLex & lex) void InsetFloat::read(Buffer const & buf, Lexer & lex)
{ {
params_.read(lex); params_.read(lex);
wide(params_.wide, buf.params()); wide(params_.wide, buf.params());
@ -433,7 +433,7 @@ void InsetFloatMailer::string2params(string const & in,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;

View File

@ -27,7 +27,7 @@ public:
/// ///
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
void read(LyXLex & lex); void read(Lexer & lex);
/// ///
std::string type; std::string type;
/// ///
@ -51,7 +51,7 @@ public:
/// ///
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
/// ///

View File

@ -21,7 +21,7 @@
#include "FuncRequest.h" #include "FuncRequest.h"
#include "gettext.h" #include "gettext.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "TocBackend.h" #include "TocBackend.h"
@ -72,7 +72,7 @@ void InsetFloatList::write(Buffer const &, ostream & os) const
} }
void InsetFloatList::read(Buffer const & buf, LyXLex & lex) void InsetFloatList::read(Buffer const & buf, Lexer & lex)
{ {
FloatList const & floats = buf.params().getLyXTextClass().floats(); FloatList const & floats = buf.params().getLyXTextClass().floats();
string token; string token;

View File

@ -37,7 +37,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const &, LyXLex &); void read(Buffer const &, Lexer &);
/// ///
int latex(Buffer const &, odocstream &, int latex(Buffer const &, odocstream &,
OutputParams const &) const; OutputParams const &) const;

View File

@ -65,7 +65,7 @@ TODO
#include "gettext.h" #include "gettext.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyXLength.h" #include "LyXLength.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "Mover.h" #include "Mover.h"
#include "OutputParams.h" #include "OutputParams.h"
@ -262,7 +262,7 @@ void InsetGraphics::write(Buffer const & buf, ostream & os) const
} }
void InsetGraphics::read(Buffer const & buf, LyXLex & lex) void InsetGraphics::read(Buffer const & buf, Lexer & lex)
{ {
string const token = lex.getString(); string const token = lex.getString();
@ -275,7 +275,7 @@ void InsetGraphics::read(Buffer const & buf, LyXLex & lex)
} }
void InsetGraphics::readInsetGraphics(LyXLex & lex, string const & bufpath) void InsetGraphics::readInsetGraphics(Lexer & lex, string const & bufpath)
{ {
bool finished = false; bool finished = false;
@ -965,7 +965,7 @@ void InsetGraphicsMailer::string2params(string const & in,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;

View File

@ -41,7 +41,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, Lexer & lex);
/** returns the number of rows (\n's) of generated tex code. /** returns the number of rows (\n's) of generated tex code.
#fragile == true# means, that the inset should take care about #fragile == true# means, that the inset should take care about
@ -89,7 +89,7 @@ private:
virtual std::auto_ptr<InsetBase> doClone() const; virtual std::auto_ptr<InsetBase> doClone() const;
/// Read the inset native format /// Read the inset native format
void readInsetGraphics(LyXLex & lex, std::string const & bufpath); void readInsetGraphics(Lexer & lex, std::string const & bufpath);
/// Get the status message, depends on the image loading status. /// Get the status message, depends on the image loading status.
std::string const statusMessage() const; std::string const statusMessage() const;

View File

@ -15,7 +15,7 @@
#include "debug.h" #include "debug.h"
#include "LyX.h" // for use_gui #include "LyX.h" // for use_gui
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "graphics/GraphicsParams.h" #include "graphics/GraphicsParams.h"
@ -192,7 +192,7 @@ void InsetGraphicsParams::Write(ostream & os, string const & bufpath) const
} }
bool InsetGraphicsParams::Read(LyXLex & lex, string const & token, string const & bufpath) bool InsetGraphicsParams::Read(Lexer & lex, string const & token, string const & bufpath)
{ {
if (token == "filename") { if (token == "filename") {
lex.eatLine(); lex.eatLine();

View File

@ -22,7 +22,7 @@ namespace lyx {
namespace graphics { class Params; } namespace graphics { class Params; }
class LyXLex; class Lexer;
/// This class holds all the parameters needed by insetGraphics. /// This class holds all the parameters needed by insetGraphics.
@ -73,7 +73,7 @@ public:
/// Save the parameters in the LyX format stream. /// Save the parameters in the LyX format stream.
void Write(std::ostream & os, std::string const & bufpath) const; void Write(std::ostream & os, std::string const & bufpath) const;
/// If the token belongs to our parameters, read it. /// If the token belongs to our parameters, read it.
bool Read(LyXLex & lex, std::string const & token, std::string const & bufpath); bool Read(Lexer & lex, std::string const & token, std::string const & bufpath);
/// convert /// convert
// Only a subset of InsetGraphicsParams is needed for display purposes. // Only a subset of InsetGraphicsParams is needed for display purposes.
// This function also interrogates lyxrc to ascertain whether // This function also interrogates lyxrc to ascertain whether

View File

@ -27,7 +27,7 @@
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyX.h" #include "LyX.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "OutputParams.h" #include "OutputParams.h"
#include "TocBackend.h" #include "TocBackend.h"
@ -262,13 +262,13 @@ void InsetInclude::write(ostream & os) const
} }
void InsetInclude::read(Buffer const &, LyXLex & lex) void InsetInclude::read(Buffer const &, Lexer & lex)
{ {
read(lex); read(lex);
} }
void InsetInclude::read(LyXLex & lex) void InsetInclude::read(Lexer & lex)
{ {
if (lex.isOK()) { if (lex.isOK()) {
lex.eatLine(); lex.eatLine();
@ -826,7 +826,7 @@ void InsetIncludeMailer::string2params(string const & in,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;

View File

@ -79,7 +79,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const &, LyXLex &); void read(Buffer const &, Lexer &);
/// ///
int latex(Buffer const &, odocstream &, int latex(Buffer const &, odocstream &,
OutputParams const &) const; OutputParams const &) const;
@ -120,7 +120,7 @@ private:
/// ///
void write(std::ostream &) const; void write(std::ostream &) const;
/// ///
void read(LyXLex &); void read(Lexer &);
/// the parameters /// the parameters
InsetCommandParams params_; InsetCommandParams params_;

View File

@ -30,7 +30,7 @@ using std::endl;
using std::ostream; using std::ostream;
void InsetLine::read(Buffer const &, LyXLex &) void InsetLine::read(Buffer const &, Lexer &)
{ {
/* Nothing to read */ /* Nothing to read */
} }

View File

@ -38,7 +38,7 @@ public:
int docbook(Buffer const &, odocstream &, int docbook(Buffer const &, odocstream &,
OutputParams const &) const; OutputParams const &) const;
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, Lexer & lex);
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset /// We don't need \begin_inset and \end_inset

View File

@ -30,7 +30,7 @@ using std::endl;
using std::ostream; using std::ostream;
void InsetNewline::read(Buffer const &, LyXLex &) void InsetNewline::read(Buffer const &, Lexer &)
{ {
/* Nothing to read */ /* Nothing to read */
} }

View File

@ -35,7 +35,7 @@ public:
int docbook(Buffer const &, odocstream &, OutputParams const &) const; int docbook(Buffer const &, odocstream &, OutputParams const &) const;
virtual void read(Buffer const &, LyXLex & lex); virtual void read(Buffer const &, Lexer & lex);
virtual void write(Buffer const & buf, std::ostream & os) const; virtual void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset /// We don't need \begin_inset and \end_inset

View File

@ -24,7 +24,7 @@
#include "gettext.h" #include "gettext.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "OutputParams.h" #include "OutputParams.h"
#include "Paragraph.h" #include "Paragraph.h"
@ -101,7 +101,7 @@ void InsetNoteParams::write(ostream & os) const
} }
void InsetNoteParams::read(LyXLex & lex) void InsetNoteParams::read(Lexer & lex)
{ {
string label; string label;
lex >> label; lex >> label;
@ -157,7 +157,7 @@ void InsetNote::write(Buffer const & buf, ostream & os) const
} }
void InsetNote::read(Buffer const & buf, LyXLex & lex) void InsetNote::read(Buffer const & buf, Lexer & lex)
{ {
params_.read(lex); params_.read(lex);
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
@ -391,7 +391,7 @@ void InsetNoteMailer::string2params(string const & in,
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;

View File

@ -32,7 +32,7 @@ public:
/// ///
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
void read(LyXLex & lex); void read(Lexer & lex);
/// ///
Type type; Type type;
}; };
@ -54,7 +54,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
void setButtonLabel(); void setButtonLabel();
/// show the note dialog /// show the note dialog

View File

@ -32,7 +32,7 @@ using std::endl;
using std::ostream; using std::ostream;
void InsetPagebreak::read(Buffer const &, LyXLex &) void InsetPagebreak::read(Buffer const &, Lexer &)
{ {
/* Nothing to read */ /* Nothing to read */
} }

View File

@ -38,7 +38,7 @@ public:
int docbook(Buffer const &, odocstream &, int docbook(Buffer const &, odocstream &,
OutputParams const &) const; OutputParams const &) const;
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, Lexer & lex);
virtual void write(Buffer const & buf, std::ostream & os) const; virtual void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset /// We don't need \begin_inset and \end_inset

View File

@ -17,7 +17,7 @@
#include "debug.h" #include "debug.h"
#include "Language.h" #include "Language.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "OutputParams.h" #include "OutputParams.h"
@ -284,7 +284,7 @@ void InsetQuotes::write(Buffer const &, ostream & os) const
} }
void InsetQuotes::read(Buffer const &, LyXLex & lex) void InsetQuotes::read(Buffer const &, Lexer & lex)
{ {
lex.next(); lex.next();
parseString(lex.getString()); parseString(lex.getString());

View File

@ -84,7 +84,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, Lexer & lex);
/// ///
int latex(Buffer const &, odocstream &, OutputParams const &) const; int latex(Buffer const &, odocstream &, OutputParams const &) const;
/// ///

View File

@ -17,7 +17,7 @@
#include "debug.h" #include "debug.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "OutputParams.h" #include "OutputParams.h"
@ -140,7 +140,7 @@ void InsetSpace::write(Buffer const &, ostream & os) const
} }
void InsetSpace::read(Buffer const &, LyXLex & lex) void InsetSpace::read(Buffer const &, Lexer & lex)
{ {
lex.next(); lex.next();
string const command = lex.getString(); string const command = lex.getString();

View File

@ -62,7 +62,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// Will not be used when lyxf3 /// Will not be used when lyxf3
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, Lexer & lex);
/// ///
int latex(Buffer const &, odocstream &, int latex(Buffer const &, odocstream &,
OutputParams const &) const; OutputParams const &) const;

View File

@ -17,7 +17,7 @@
#include "debug.h" #include "debug.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
@ -147,7 +147,7 @@ void InsetSpecialChar::write(Buffer const &, ostream & os) const
// This function will not be necessary when lyx3 // This function will not be necessary when lyx3
void InsetSpecialChar::read(Buffer const &, LyXLex & lex) void InsetSpecialChar::read(Buffer const &, Lexer & lex)
{ {
lex.next(); lex.next();
string const command = lex.getString(); string const command = lex.getString();

View File

@ -54,7 +54,7 @@ public:
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// Will not be used when lyxf3 /// Will not be used when lyxf3
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, Lexer & lex);
/// ///
int latex(Buffer const &, odocstream &, int latex(Buffer const &, odocstream &,
OutputParams const &) const; OutputParams const &) const;

View File

@ -26,7 +26,7 @@
#include "Language.h" #include "Language.h"
#include "LColor.h" #include "LColor.h"
#include "lyx_cb.h" #include "lyx_cb.h"
#include "LyXLex.h" #include "Lexer.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "OutputParams.h" #include "OutputParams.h"
#include "Paragraph.h" #include "Paragraph.h"
@ -220,7 +220,7 @@ void InsetTabular::write(Buffer const & buf, ostream & os) const
} }
void InsetTabular::read(Buffer const & buf, LyXLex & lex) void InsetTabular::read(Buffer const & buf, Lexer & lex)
{ {
bool const old_format = (lex.getString() == "\\LyXTable"); bool const old_format = (lex.getString() == "\\LyXTable");
@ -2112,7 +2112,7 @@ string const InsetTabularMailer::inset2string(Buffer const &) const
void InsetTabularMailer::string2params(string const & in, InsetTabular & inset) void InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
{ {
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
if (in.empty()) if (in.empty())

View File

@ -39,7 +39,7 @@
namespace lyx { namespace lyx {
class FuncStatus; class FuncStatus;
class LyXLex; class Lexer;
class BufferView; class BufferView;
class Buffer; class Buffer;
class BufferParams; class BufferParams;
@ -56,7 +56,7 @@ public:
/// ///
~InsetTabular(); ~InsetTabular();
/// ///
void read(Buffer const &, LyXLex &); void read(Buffer const &, Lexer &);
/// ///
void write(Buffer const &, std::ostream &) const; void write(Buffer const &, std::ostream &) const;
/// ///

View File

@ -27,7 +27,7 @@
#include "Intl.h" #include "Intl.h"
#include "LColor.h" #include "LColor.h"
#include "lyxfind.h" #include "lyxfind.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "LyXText.h" #include "LyXText.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
@ -141,7 +141,7 @@ void InsetText::write(Buffer const & buf, ostream & os) const
} }
void InsetText::read(Buffer const & buf, LyXLex & lex) void InsetText::read(Buffer const & buf, Lexer & lex)
{ {
clear(); clear();

View File

@ -47,7 +47,7 @@ public:
/// empty inset to empty par /// empty inset to empty par
void clear(); void clear();
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// ///

View File

@ -19,7 +19,7 @@
#include "FuncRequest.h" #include "FuncRequest.h"
#include "gettext.h" #include "gettext.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "LyXText.h" #include "LyXText.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "OutputParams.h" #include "OutputParams.h"
@ -83,7 +83,7 @@ void InsetVSpace::doDispatch(LCursor & cur, FuncRequest & cmd)
} }
void InsetVSpace::read(Buffer const &, LyXLex & lex) void InsetVSpace::read(Buffer const &, Lexer & lex)
{ {
BOOST_ASSERT(lex.isOK()); BOOST_ASSERT(lex.isOK());
string vsp; string vsp;
@ -247,7 +247,7 @@ void InsetVSpaceMailer::string2params(string const & in, VSpace & vspace)
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;

View File

@ -42,7 +42,7 @@ public:
int docbook(Buffer const &, odocstream &, int docbook(Buffer const &, odocstream &,
OutputParams const &) const; OutputParams const &) const;
/// ///
void read(Buffer const &, LyXLex & lex); void read(Buffer const &, Lexer & lex);
/// ///
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// ///

View File

@ -25,7 +25,7 @@
#include "gettext.h" #include "gettext.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "OutputParams.h" #include "OutputParams.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "TocBackend.h" #include "TocBackend.h"
@ -121,7 +121,7 @@ void InsetWrapParams::write(ostream & os) const
} }
void InsetWrapParams::read(LyXLex & lex) void InsetWrapParams::read(Lexer & lex)
{ {
string token; string token;
lex >> token; lex >> token;
@ -153,7 +153,7 @@ void InsetWrap::write(Buffer const & buf, ostream & os) const
} }
void InsetWrap::read(Buffer const & buf, LyXLex & lex) void InsetWrap::read(Buffer const & buf, Lexer & lex)
{ {
params_.read(lex); params_.read(lex);
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
@ -262,7 +262,7 @@ void InsetWrapMailer::string2params(string const & in, InsetWrapParams & params)
return; return;
istringstream data(in); istringstream data(in);
LyXLex lex(0,0); Lexer lex(0,0);
lex.setStream(data); lex.setStream(data);
string name; string name;

View File

@ -25,7 +25,7 @@ public:
/// ///
void write(std::ostream &) const; void write(std::ostream &) const;
/// ///
void read(LyXLex &); void read(Lexer &);
/// ///
std::string type; std::string type;
@ -47,7 +47,7 @@ public:
/// ///
void write(Buffer const & buf, std::ostream & os) const; void write(Buffer const & buf, std::ostream & os) const;
/// ///
void read(Buffer const & buf, LyXLex & lex); void read(Buffer const & buf, Lexer & lex);
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
/// ///

View File

@ -18,7 +18,7 @@
#include "debug.h" #include "debug.h"
#include "kb_sequence.h" #include "kb_sequence.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "LyXLex.h" #include "Lexer.h"
#include "frontends/LyXKeySym.h" #include "frontends/LyXKeySym.h"
@ -95,7 +95,7 @@ bool kb_keymap::read(string const & bind_file)
{ {
const int bindCount = sizeof(bindTags) / sizeof(keyword_item); const int bindCount = sizeof(bindTags) / sizeof(keyword_item);
LyXLex lexrc(bindTags, bindCount); Lexer lexrc(bindTags, bindCount);
if (lyxerr.debugging(Debug::PARSER)) if (lyxerr.debugging(Debug::PARSER))
lexrc.printTable(lyxerr); lexrc.printTable(lyxerr);
@ -112,11 +112,11 @@ bool kb_keymap::read(string const & bind_file)
bool error = false; bool error = false;
while (lexrc.isOK()) { while (lexrc.isOK()) {
switch (lexrc.lex()) { switch (lexrc.lex()) {
case LyXLex::LEX_UNDEF: case Lexer::LEX_UNDEF:
lexrc.printError("Unknown tag `$$Token'"); lexrc.printError("Unknown tag `$$Token'");
error = true; error = true;
continue; continue;
case LyXLex::LEX_FEOF: case Lexer::LEX_FEOF:
continue; continue;
case BN_BIND: case BN_BIND:
{ {

View File

@ -20,7 +20,7 @@
#include "debug.h" #include "debug.h"
#include "gettext.h" #include "gettext.h"
#include "LColor.h" #include "LColor.h"
#include "LyXLex.h" #include "Lexer.h"
#include "OutputParams.h" #include "OutputParams.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
@ -108,7 +108,7 @@ int InsetFormulaMacro::docbook(Buffer const & buf, ostream & os,
} }
void InsetFormulaMacro::read(Buffer const &, LyXLex & lex) void InsetFormulaMacro::read(Buffer const &, Lexer & lex)
{ {
read(lex.getStream()); read(lex.getStream());
} }

Some files were not shown because too many files have changed in this diff Show More