2000-04-08 17:02:02 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
|
|
|
|
#ifndef LYXLEX_PIMPL_H
|
|
|
|
#define LYXLEX_PIMPL_H
|
|
|
|
|
|
|
|
#include <fstream>
|
2000-08-05 05:17:18 +00:00
|
|
|
#include <stack>
|
2001-03-16 12:08:14 +00:00
|
|
|
#include <boost/utility.hpp>
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
|
|
#include "lyxlex.h"
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
///
|
2001-03-16 11:54:34 +00:00
|
|
|
struct LyXLex::Pimpl : public boost::noncopyable {
|
2000-04-08 17:02:02 +00:00
|
|
|
///
|
|
|
|
enum {
|
|
|
|
///
|
|
|
|
LEX_MAX_BUFF = 2048
|
|
|
|
};
|
|
|
|
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
Pimpl(keyword_item * tab, int num);
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-08-05 05:17:18 +00:00
|
|
|
string const GetString() const;
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
void printError(string const & message) const;
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
void printTable(std::ostream & os);
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
void pushTable(keyword_item * tab, int num);
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
void popTable();
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
bool setFile(string const & filename);
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
void setStream(std::istream & i);
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-11-08 15:19:55 +00:00
|
|
|
void setCommentChar(char c);
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
bool next(bool esc = false);
|
|
|
|
///
|
|
|
|
int search_kw(char const * const tag) const;
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
int lex();
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
bool EatLine();
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
bool nextToken();
|
2000-07-31 16:39:50 +00:00
|
|
|
///
|
2000-05-17 14:43:09 +00:00
|
|
|
void pushToken(string const &);
|
2000-04-08 17:02:02 +00:00
|
|
|
/// fb__ is only used to open files, the stream is accessed through is
|
|
|
|
std::filebuf fb__;
|
|
|
|
/// the stream that we use.
|
|
|
|
std::istream is;
|
|
|
|
///
|
|
|
|
string name;
|
|
|
|
///
|
|
|
|
keyword_item * table;
|
|
|
|
///
|
|
|
|
int no_items;
|
|
|
|
///
|
|
|
|
char buff[LEX_MAX_BUFF];
|
|
|
|
///
|
|
|
|
short status;
|
|
|
|
///
|
|
|
|
int lineno;
|
2000-05-17 14:43:09 +00:00
|
|
|
///
|
|
|
|
string pushTok;
|
2000-11-08 15:19:55 +00:00
|
|
|
///
|
|
|
|
char commentChar;
|
2000-08-05 05:17:18 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
void verifyTable();
|
|
|
|
///
|
|
|
|
struct pushed_table {
|
|
|
|
///
|
|
|
|
pushed_table()
|
|
|
|
: table_elem(0), table_siz(0) {}
|
|
|
|
///
|
|
|
|
pushed_table(keyword_item * ki, int siz)
|
|
|
|
: table_elem(ki), table_siz(siz) {}
|
|
|
|
///
|
|
|
|
keyword_item * table_elem;
|
|
|
|
///
|
|
|
|
int table_siz;
|
|
|
|
};
|
|
|
|
///
|
|
|
|
std::stack<pushed_table> pushed;
|
2000-04-08 17:02:02 +00:00
|
|
|
};
|
|
|
|
#endif
|