Exemplo n.º 1
0
 void Parser::xmlElementContent(XmlContext* ctx)
 {
     for (;;) {
         xmlAtom();
         switch (T0) {
             case T_XmlProcessingInstruction:
             case T_XmlComment:
             case T_XmlCDATA:
             case T_XmlName:
             case T_XmlWhitespace:
             case T_XmlText:
             case T_XmlString:
             case T_XmlRightBrace:
             case T_XmlRightAngle:
             case T_XmlSlashRightAngle:
             case T_XmlEquals:
                 xmlAssert(ctx, T0);
                 continue;
             case T_XmlLeftBrace:
                 xmlExpression(ctx, ESC_elementValue);
                 continue;
             case T_XmlLeftAngle:
                 xmlAssert(ctx, T0);
                 xmlAtomSkipSpace();
                 xmlElement(ctx);
                 continue;
             case T_XmlLeftAngleSlash:
                 return;
             default:
                 compiler->internalError(position(), "Unexpected state in XML parsing");
         }
     }
 }
Exemplo n.º 2
0
 void Parser::xmlExpression(XmlContext* ctx, Escapement esc)
 {
     AvmAssert( T0 == T_XmlLeftBrace );
     next();     // re-enter normal lexing
     Expr* expr = commaExpression(0);
     if (esc != ESC_none)
         expr = ALLOC(EscapeExpr, (expr, esc));
     ctx->addExpr(expr);
     AvmAssert( T0 == T_RightBrace && T1 == T_LAST );
     xmlPushback('}');
     xmlAtom();
     xmlAssert(ctx, T_XmlRightBrace);
 }
Expr* Parser::xmlInitializer()
{
    AvmAssert( (T0 == T_BreakXml || T0 == T_LessThan) && T1 == T_LAST );

    XmlContext ctx(compiler);
    bool is_list = false;
    uint32_t pos = position();

    if (T0 == T_LessThan)
        xmlPushback('<');
    xmlAtom();
    switch (T0) {
    case T_XmlComment:
    case T_XmlCDATA:
    case T_XmlProcessingInstruction:
        xmlAssert(&ctx, T0);
        break;

    case T_XmlLeftAngle:
        xmlAssert(&ctx, T0);
        xmlAtomSkipSpace();
        if (T0 == T_XmlRightAngle) {
            is_list = true;
            xmlListInitializer(&ctx);
        }
        else
            xmlElement(&ctx);
        break;

    default:
        compiler->internalError(position(), "error state in xml handling");
        /*NOTREACHED*/
        break;
    }

    next();				// Re-synchronize the lexer for normal lexing
    return ALLOC(XmlInitializer, (ctx.get(), is_list, pos));
}
Exemplo n.º 4
0
 void Parser::xmlAtomSkipSpace()
 {
     do {
         xmlAtom();
     } while (T0 == T_XmlWhitespace);
 }