Пример #1
0
/**
 * @return true if the token stream in its present state can convert
 * the token stream to a set expression.
 *
 * @param in -- The token stream.
 * @return true if the stream of tokens can be accepted, false otherwise.
 */
bool Set_::CanAccept_( Parser const& parser
                       , TokenStream& stream
                       , std::vector<strine::Element>& elements) const
{
    bool can_accept = parser.CanParse( stream
                                       , Set_::parse_rules
                                       , elements );
    return can_accept;
}
Пример #2
0
/**
 * @return true if the token stream in its present state can convert
 * the token stream to an error expression.
 *
 * @param in -- The token stream.
 * @return true if the stream of tokens can be accepted, false otherwise.
 */ 
bool Error_::CanAccept_( Parser const& parser
                     , TokenStream& stream 
                     , std::vector<strine::Element>& elements) const
{
    bool can_accept = parser.CanParse( stream
                                     , Error_::error_parse_rules1
                                     , elements );

    if (false == can_accept)
    {
        stream.Rollback();
        can_accept = parser.CanParse( stream
                                    , Error_::error_parse_rules2
                                    , elements );
    }

    return can_accept;
}