示例#1
0
文件: Parser.hpp 项目: rayfill/cpplib
	bool parse(scanner_t& scanner, skip_t& ) const
	{
		scanner.save();
		const int value = scanner.read();
		if (value != -1 &&
			traits_type::to_char_type(value) == character)
		{
			scanner.commit();
			return true;
		}
		
		scanner.rollback();
		return false;
	}
示例#2
0
文件: Parser.hpp 项目: rayfill/cpplib
	bool parse(scanner_t& scanner, skip_t& skip_p) const
	{
		scanner.save();

		const int input = scanner.read();
		if (input != -1 &&
			traits_type::to_char_type(input) >= small &&
			traits_type::to_char_type(input) <= large)
		{
			scanner.commit();
			return true;
		}

		scanner.rollback();
		return false;
	}
示例#3
0
文件: Parser.hpp 项目: rayfill/cpplib
	bool parse(scanner_t& scanner, skip_t& ) const
	{
		scanner.save();
		
		for (typename string_type::const_iterator itor = literal.begin();
			 itor != literal.end(); ++itor)
		{
			const int val = scanner.read();
			if (val == -1 ||
				traits_type::to_char_type(val) != *itor)
			{
				scanner.rollback();
				return false;
			}
		}
		scanner.commit();
		return true;
	}