Exemple #1
0
/** True if the next token begins the close tag */
static bool atClose(TextInput& t, const std::string name) {
    if ((t.peek().type() == Token::SYMBOL) && (t.peek().string() == "<")) {
        // Need to keep looking ahead
        Token p0 = t.read();
        if ((t.peek().type() == Token::SYMBOL) && (t.peek().string() == "/")) {
            // Check the name on the close tag.  It *must* match if
            // this is a well-formed document, but there might be a
            // tag error.
            Token p1 = t.read();
            Token p2 = t.peek();
            std::string s = p2.string();
            debugAssertM(beginsWith(name, s), "Mismatched close tag");

            // Put the tokens back
            t.push(p1);
            t.push(p0);
            return true;
        } else {
            // Put the read token back
            t.push(p0);
            return false;
        }
    } else {
        return false;
    }
}
Exemple #2
0
	void Any::deserialize(TextInput& ti) {
		beforeRead();
		Token token = ti.read();
		deserialize(ti, token);
		// Restore the last token
		ti.push(token);
	}