break parser::tokenize in parts

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27454 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2008-11-15 14:38:27 +00:00
parent 0aaed41dd7
commit fa3ea10057
2 changed files with 80 additions and 71 deletions

View File

@ -351,17 +351,11 @@ string const Parser::verbatimEnvironment(string const & name)
}
void Parser::tokenize(istream & is)
void Parser::tokenize_one(istream & is)
{
static bool init_done = false;
if (!init_done) {
catInit();
init_done = true;
}
char c;
while (is.get(c)) {
if (!is.get(c))
return;
//cerr << "reading c: " << c << "\n";
switch (catcode(c)) {
@ -430,7 +424,20 @@ void Parser::tokenize(istream & is)
default:
push_back(Token(c, catcode(c)));
}
}
void Parser::tokenize(istream & is)
{
static bool init_done = false;
if (!init_done) {
catInit();
init_done = true;
}
while (is)
tokenize_one(is);
}

View File

@ -174,6 +174,8 @@ public:
char getChar();
///
void error(std::string const & msg);
/// Parses one token from \p is
void tokenize_one(std::istream & is);
/// Parses \p is into tokens
void tokenize(std::istream & is);
///