function parseTag(context, type, parent) {
    __DEV__ && assert(/^<\/?[a-z]/i.test(context.source));
    __DEV__ &&
        assert(type === (startsWith(context.source, '</') ? 1 /* End */ : 0 /* Start */));
    // Tag open.
    const start = getCursor(context);
    const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
    const tag = match[1];
    const ns = context.options.getNamespace(tag, parent);
    advanceBy(context, match[0].length);
    advanceSpaces(context);
    // save current state in case we need to re-parse attributes with v-pre
    const cursor = getCursor(context);
    const currentSource = context.source;
    // Attributes.
    let props = parseAttributes(context, type);
    // check v-pre
    if (!context.inPre &&
        props.some(p => p.type === 7 /* DIRECTIVE */ && p.name === 'pre')) {
        context.inPre = true;
        // reset context
        extend(context, cursor);
        context.source = currentSource;
        // re-parse attrs and filter out v-pre itself
        props = parseAttributes(context, type).filter(p => p.name !== 'v-pre');
    }
    // Tag close.
    let isSelfClosing = false;
    if (context.source.length === 0) {
        emitError(context, 12 /* EOF_IN_TAG */);
    }
    else {
        isSelfClosing = startsWith(context.source, '/>');
        if (type === 1 /* End */ && isSelfClosing) {
            emitError(context, 7 /* END_TAG_WITH_TRAILING_SOLIDUS */);
        }
        advanceBy(context, isSelfClosing ? 2 : 1);
    }
    let tagType = 0 /* ELEMENT */;
    if (!context.inPre && !context.options.isCustomElement(tag)) {
        if (context.options.isNativeTag) {
            if (!context.options.isNativeTag(tag))
                tagType = 1 /* COMPONENT */;
        }
        else {
            if (/^[A-Z]/.test(tag))
                tagType = 1 /* COMPONENT */;
        }
        if (tag === 'slot')
            tagType = 2 /* SLOT */;
        else if (tag === 'template')
            tagType = 3 /* TEMPLATE */;
        else if (tag === 'portal' || tag === 'Portal')
            tagType = 4 /* PORTAL */;
        else if (tag === 'suspense' || tag === 'Suspense')
            tagType = 5 /* SUSPENSE */;
    }
    return {
        type: 1 /* ELEMENT */,
        ns,
        tag,
        tagType,
        props,
        isSelfClosing,
        children: [],
        loc: getSelection(context, start),
        codegenNode: undefined // to be created during transform phase
    };
}
/**
 * Parse a tag (E.g. `<div id=a>`) with that type (start tag or end tag).
 */
Parse a tag  with that type (start tag or end tag).
Parse a tag with that type ( start tag or end tag ) .
function parseTag(context, type, parent) {
    __DEV__ && assert(/^<\/?[a-z]/i.test(context.source));
    __DEV__ &&
        assert(type === (startsWith(context.source, '</') ? 1  : 0 ));
    const start = getCursor(context);
    const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
    const tag = match[1];
    const ns = context.options.getNamespace(tag, parent);
    advanceBy(context, match[0].length);
    advanceSpaces(context);
    const cursor = getCursor(context);
    const currentSource = context.source;
    let props = parseAttributes(context, type);
    if (!context.inPre &&
        props.some(p => p.type === 7  && p.name === 'pre')) {
        context.inPre = true;
        extend(context, cursor);
        context.source = currentSource;
        props = parseAttributes(context, type).filter(p => p.name !== 'v-pre');
    }
    let isSelfClosing = false;
    if (context.source.length === 0) {
        emitError(context, 12 );
    }
    else {
        isSelfClosing = startsWith(context.source, '/>');
        if (type === 1  && isSelfClosing) {
            emitError(context, 7 );
        }
        advanceBy(context, isSelfClosing ? 2 : 1);
    }
    let tagType = 0 ;
    if (!context.inPre && !context.options.isCustomElement(tag)) {
        if (context.options.isNativeTag) {
            if (!context.options.isNativeTag(tag))
                tagType = 1 ;
        }
        else {
            if (/^[A-Z]/.test(tag))
                tagType = 1 ;
        }
        if (tag === 'slot')
            tagType = 2 ;
        else if (tag === 'template')
            tagType = 3 ;
        else if (tag === 'portal' || tag === 'Portal')
            tagType = 4 ;
        else if (tag === 'suspense' || tag === 'Suspense')
            tagType = 5 ;
    }
    return {
        type: 1 ,
        ns,
        tag,
        tagType,
        props,
        isSelfClosing,
        children: [],
        loc: getSelection(context, start),
        codegenNode: undefined 
    };
}
function parseTag ( context , type , parent ) { __DEV__ && assert ( / ^<\/?[a-z] / i . test ( context . source ) ) ; __DEV__ && assert ( type === ( startsWith ( context . source , '</' ) ? 1 : 0 ) ) ; const start = getCursor ( context ) ; const match = / ^<\/?([a-z][^\t\r\n\f />]*) / i . exec ( context . source ) ; const tag = match [ 1 ] ; const ns = context . options . getNamespace ( tag , parent ) ; advanceBy ( context , match [ 0 ] . length ) ; advanceSpaces ( context ) ; const cursor = getCursor ( context ) ; const currentSource = context . source ; let props = parseAttributes ( context , type ) ; if ( ! context . inPre && props . some ( p => p . type === 7 && p . name === 'pre' ) ) { context . inPre = true ; extend ( context , cursor ) ; context . source = currentSource ; props = parseAttributes ( context , type ) . filter ( p => p . name !== 'v-pre' ) ; } let isSelfClosing = false ; if ( context . source . length === 0 ) { emitError ( context , 12 ) ; } else { isSelfClosing = startsWith ( context . source , '/>' ) ; if ( type === 1 && isSelfClosing ) { emitError ( context , 7 ) ; } advanceBy ( context , isSelfClosing ? 2 : 1 ) ; } let tagType = 0 ; if ( ! context . inPre && ! context . options . isCustomElement ( tag ) ) { if ( context . options . isNativeTag ) { if ( ! context . options . isNativeTag ( tag ) ) tagType = 1 ; } else { if ( / ^[A-Z] / . test ( tag ) ) tagType = 1 ; } if ( tag === 'slot' ) tagType = 2 ; else if ( tag === 'template' ) tagType = 3 ; else if ( tag === 'portal' || tag === 'Portal' ) tagType = 4 ; else if ( tag === 'suspense' || tag === 'Suspense' ) tagType = 5 ; } return { type : 1 , ns , tag , tagType , props , isSelfClosing , children : [ ] , loc : getSelection ( context , start ) , codegenNode : undefined } ; }
Parse a tag (E.g.
Parse a tag ( E . g .
/* End */ /* Start */ // Tag open. // save current state in case we need to re-parse attributes with v-pre // Attributes. // check v-pre /* DIRECTIVE */ // reset context // re-parse attrs and filter out v-pre itself // Tag close. /* EOF_IN_TAG */ /* End */ /* END_TAG_WITH_TRAILING_SOLIDUS */ /* ELEMENT */ /* COMPONENT */ /* COMPONENT */ /* SLOT */ /* TEMPLATE */ /* PORTAL */ /* SUSPENSE */ /* ELEMENT */ // to be created during transform phase