28#include <QtCore/private/qglobal_p.h>
36#ifndef QXMLSTREAMPARSER_P_H
37#define QXMLSTREAMPARSER_P_H
41#if QT_CONFIG(xmlstreamreader)
50 case QXmlStreamReader::StartElement:
58 setType(QXmlStreamReader::EndElement);
69 case QXmlStreamReader::EndElement:
76 case QXmlStreamReader::DTD:
83 case QXmlStreamReader::Comment:
84 case QXmlStreamReader::Characters:
90 case QXmlStreamReader::EntityReference:
95 case QXmlStreamReader::ProcessingInstruction:
100 case QXmlStreamReader::NoToken:
101 case QXmlStreamReader::Invalid:
103 case QXmlStreamReader::StartDocument:
118 setType(QXmlStreamReader::NoToken);
128 goto ResumeReduction;
138 if ((cu != ~0U) && (cu & 0xff0000)) {
162 raiseError(QXmlStreamReader::PrematureEndOfDocumentError);
273 }
else if (act > 0) {
289 }
else if (act < 0) {
292#if defined (QLALR_DEBUG)
293 int ridx = rule_index[
r];
294 printf (
"%3d) %s ::=",
r + 1,
spell[rule_info[ridx]]);
296 for (
int i = ridx;
i < ridx +
rhs[
r]; ++
i) {
297 int symbol = rule_info[
i];
299 printf (
" %s",
name);
301 printf (
" #%d", symbol);
312 setType(QXmlStreamReader::EndDocument);
316 if (
type != QXmlStreamReader::Invalid) {
318 setType(QXmlStreamReader::EndDocument);
320 raiseError(QXmlStreamReader::NotWellFormedError, QXmlStream::tr(
"Start tag expected."));
334 it->isCurrentlyReferenced =
false;
348 setType(QXmlStreamReader::StartDocument);
380 setType(QXmlStreamReader::DTD);
431 dtdAttribute.tagName.clear();
436 dtdAttribute.isNamespaceAttribute = (dtdAttribute.attributePrefix ==
"xmlns"_L1
437 || (dtdAttribute.attributePrefix.isEmpty()
438 && dtdAttribute.attributeName ==
"xmlns"_L1));
440 dtdAttribute.defaultValue.clear();
442 if (dtdAttribute.isCDATA)
457 if (!dtdAttribute.tagName.isNull())
459 dtdAttribute.tagName = tagName;
462 &&
dtdAttributes[
i].attributeQualifiedName == dtdAttribute.attributeQualifiedName) {
463 dtdAttribute.attributeQualifiedName.
clear();
476 entityDeclaration.clear();
486 entityDeclaration.clear();
488 entityDeclaration.parameter =
true;
497 entityDeclaration.systemId =
symString(3);
498 entityDeclaration.external =
true;
508 entityDeclaration.systemId =
symString(5);
509 entityDeclaration.external =
true;
514 entityDeclaration.notationName =
symString(3);
515 if (entityDeclaration.parameter)
527 if (!entityDeclaration.external)
530 if (!
hash.contains(entityDeclaration.name)) {
531 Entity entity(entityDeclaration.name.toString(),
532 entityDeclaration.value.toString());
533 entity.unparsed = (!entityDeclaration.notationName.isNull());
534 entity.external = entityDeclaration.external;
540 setType(QXmlStreamReader::ProcessingInstruction);
551 }
else if (
type != QXmlStreamReader::Invalid){
558 setType(QXmlStreamReader::ProcessingInstruction);
579 setType(QXmlStreamReader::Comment);
585 setType(QXmlStreamReader::Characters);
608 notationDeclaration.systemId =
symString(3);
609 notationDeclaration.publicId.clear();
614 notationDeclaration.systemId.clear();
621 notationDeclaration.systemId =
symString(5);
638 setType(QXmlStreamReader::Characters);
720 namespaceDeclaration.prefix.clear();
723 if (
ns.view() ==
"http://www.w3.org/2000/xmlns/"_L1 ||
724 ns.view() ==
"http://www.w3.org/XML/1998/namespace"_L1)
735 for (
const DtdAttribute &dtdAttribute : std::as_const(
dtdAttributes)) {
736 if (!dtdAttribute.isCDATA
738 && dtdAttribute.attributeQualifiedName == attributeQualifiedName
748 bool wasSpace =
true;
751 if (
c.unicode() ==
' ') {
772 if (((namespacePrefix ==
"xml"_L1)
773 ^ (
namespaceUri ==
"http://www.w3.org/XML/1998/namespace"_L1))
776 || namespacePrefix ==
"xmlns"_L1)
800 setType(QXmlStreamReader::StartElement);
808 setType(QXmlStreamReader::EndElement);
812 prefix =
tag.namespaceDeclaration.prefix;
824 setType(QXmlStreamReader::EntityReference);
832 Entity &entity = *
it;
833 if (entity.unparsed) {
836 if (!entity.hasBeenParsed) {
838 entity.hasBeenParsed =
true;
852 if (!replacementText.
isNull()) {
872 Entity &entity = *
it;
873 if (entity.unparsed || entity.external) {
894 Entity &entity = *
it;
895 if (entity.unparsed || entity.value.isNull()) {
899 if (!entity.hasBeenParsed) {
901 entity.hasBeenParsed =
true;
914 if (!replacementText.
isNull()) {
991 if (
type != QXmlStreamReader::NoToken)
static constexpr auto fromUcs4(char32_t c) noexcept
constexpr char16_t unicode() const noexcept
Returns the numeric Unicode value of the QChar.
iterator find(const T &value)
bool hasError() const noexcept
Returns true if a conversion could not correctly convert a character.
bool isValid() const noexcept
Returns true if this is a valid string converter that can be used for encoding or decoding text.
int compare(QStringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
void chop(qsizetype n)
Removes n characters from the end of the string.
bool isNull() const
Returns true if this string is null; otherwise returns false.
qsizetype size() const
Returns the number of characters in this string.
QString simplified() const &
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QChar * data()
Returns a pointer to the data stored in the QString.
static int t_action(int state, int token)
static const short action_index[]
static int nt_action(int state, int nt)
static const char *const spell[]
bool scanAfterLangleBang()
uint referenceToUnparsedEntityDetected
void parseEntity(const QString &value)
void raiseError(QXmlStreamReader::Error error, const QString &message=QString())
XmlStringRef documentVersion
XmlStringRef qualifiedName
bool scanUntil(const char *str, short tokenToInject=-1)
XmlStringRef symPrefix(int index)
bool referenceEntity(QHash< QStringView, Entity > *hash, Entity &entity)
void checkPublicLiteral(QStringView publicId)
QHash< QStringView, Entity > entityHash
bool entitiesMustBeDeclared() const
bool lastAttributeIsCData
uint referenceToParameterEntityDetected
XmlStringRef namespaceUri
qsizetype fastScanLiteralContent()
QXmlStreamEntityDeclarations publicEntityDeclarations
QString resolveUndeclaredEntity(const QString &name)
std::optional< qsizetype > fastScanName(Value *val=nullptr)
QXmlStreamAttributes attributes
void putString(QStringView s, qsizetype from=0)
Value & sym(int index) const
uint resolveCharRef(int symbolIndex)
QXmlStreamSimpleStack< EntityDeclaration > entityDeclarations
qsizetype fastScanNMTOKEN()
void putStringLiteral(QStringView s)
void putReplacement(QStringView s)
bool scanAfterDefaultDecl()
XmlStringRef symName(int index)
uint filterCarriageReturn()
XmlStringRef processingInstructionData
void putReplacementInAttributeValue(QStringView s)
QXmlStreamSimpleStack< Attribute > attributeStack
qsizetype fastScanSpace()
QHash< QStringView, Entity > parameterEntityHash
void raiseWellFormedError(const QString &message)
QXmlStreamNotationDeclarations publicNotationDeclarations
XmlStringRef documentEncoding
QXmlStreamNamespaceDeclarations publicNamespaceDeclarations
QXmlStreamEntityResolver * entityResolver
QXmlStreamSimpleStack< DtdAttribute > dtdAttributes
uint hasExternalDtdSubset
qsizetype fastScanContentCharList()
XmlStringRef processingInstructionTarget
void injectToken(ushort tokenToInject)
XmlStringRef lastAttributeValue
XmlStringRef symString(int index)
QXmlStreamSimpleStack< NotationDeclaration > notationDeclarations
bool scanString(const char *str, short tokenToInject, bool requireSpace=true)
QXmlStreamSimpleStack< QEntityReference > entityReferenceStack
QStringView symView(int index) const
bool scanPublicOrSystem()
static bool isPublicID(QStringView candidate)
static bool isNCName(QStringView ncName)
QHash< int, QWidget * > hash
[35multi]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
AudioChannelLayoutTag tag
EGLOutputLayerEXT EGLint attribute
GLboolean GLboolean GLboolean GLboolean a
[7]
GLbitfield GLuint readBuffer
static void normalize(double &x, double &y)
QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept