Пример #1
0
void LaTeXFeatures::getAvailable()
{
	Lexer lex;
	support::FileName const real_file = libFileSearch("", "packages.lst");

	if (real_file.empty())
		return;

	lex.setFile(real_file);

	if (!lex.isOK())
		return;

	// Make sure that we are clean
	packages_.clear();

	bool finished = false;
	// Parse config-file
	while (lex.isOK() && !finished) {
		switch (lex.lex()) {
		case Lexer::LEX_FEOF:
			finished = true;
			break;
		default:
			packages_.insert(lex.getString());
		}
	}
}
Пример #2
0
void initAutoCorrect()
{
	LYXERR(Debug::MATHED, "reading autocorrect file");
	support::FileName const file = libFileSearch(string(), "autocorrect");
	if (file.empty()) {
		lyxerr << "Could not find autocorrect file" << endl;
		return;
	}

	string line;
	ifstream is(file.toFilesystemEncoding().c_str());
	while (getline(is, line)) {
		if (line.empty() || line[0] == '#') {
			//LYXERR(Debug::MATHED, "ignoring line '" << line << '\'');
			continue;
		}
		idocstringstream il(from_utf8(line));

		//LYXERR(Debug::MATHED, "line '" << line << '\'');
		Correction corr;
		if (corr.read(il)) {
			//LYXERR(Debug::MATHED, "parsed: '" << corr << '\'');
			theCorrections.insert(corr);
		}
	}

	LYXERR(Debug::MATHED, "done reading autocorrections.");
}