Пример #1
0
bool isExpected (Preprocessor &prep, String expected) {
	PreprocessorPosition pos = prep.getCurrentPosition();
	String buffer = prep.get();
	if (buffer != expected) {
		prep.startError (pos) << '\"' << expected << "\" expected instead of \""
			<< buffer << "\"." << endl;
		return false;
	}
	return true;
}
Пример #2
0
String getIdentifier (Preprocessor &prep) {
	PreprocessorPosition pos = prep.getCurrentPosition();
	String buffer = prep.get();
	if (!buffer.empty()) {
		if (isIdentifierChar (buffer [0])) {
			if (buffer.length() == 1 || isIdentifierChar (buffer [1]) || isNumberChar (buffer [1]))
				return buffer;
		}
	}
	prep.startError (pos) << "Identifier expected instead of \"" << buffer << "\"." << endl;
	return "<Unknown>";
}
Пример #3
0
Tag getTag (Preprocessor &prep) {
	PreprocessorPosition pos = prep.getCurrentPosition();
	String buffer = prep.get();
	if (!buffer.empty() && buffer.length() <= 4) {
		// Fill with spaces
		while (buffer.length() < 4)
			buffer += ' ';
		return (Tag &) *buffer.getChars();
	}
	prep.startError (pos) << "OpenType tag expected instead of \"" << buffer << "\"." << endl;
	return 0;
}