Esempio n. 1
0
static void sFromStrim_BodyOfTuple(const ZStrimU& iStrimU, ZTuple& oTuple)
{
    using namespace ZUtil_Strim;
    for (;;)
    {
        sSkip_WSAndCPlusPlusComments(iStrimU);

        string propertyName;
        if (!sTryRead_EscapedString(iStrimU, '"', propertyName))
        {
            if (!sTryRead_EscapedString(iStrimU, '\'', propertyName))
            {
                if (!ZUtil_Tuple::sRead_Identifier(iStrimU, nil, &propertyName))
                    break;
            }
        }

        sSkip_WSAndCPlusPlusComments(iStrimU);

        if (!sTryRead_CP(iStrimU, '='))
            throw ParseException("Expected '=' after property name");

        sSkip_WSAndCPlusPlusComments(iStrimU);

        ZTupleValue& theTupleValue = oTuple.SetMutableNull(propertyName);
        if (!sFromStrim_TupleValue(iStrimU, theTupleValue))
            throw ParseException("Expected a property value after '='");

        sSkip_WSAndCPlusPlusComments(iStrimU);

        if (!sTryRead_CP(iStrimU, ';') && !sTryRead_CP(iStrimU, ','))
            throw ParseException("Expected a ';' or a ',' after property value");
    }
}