diff options
Diffstat (limited to 'quanta/parsers/parser.cpp')
-rw-r--r-- | quanta/parsers/parser.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/quanta/parsers/parser.cpp b/quanta/parsers/parser.cpp index b8e5e619..8206ac29 100644 --- a/quanta/parsers/parser.cpp +++ b/quanta/parsers/parser.cpp @@ -119,7 +119,7 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No Node *currentNode = a_node; if (currentNode && (currentNode->tag->type != Tag::XmlTag || currentNode->tag->single)) - parentNode = currentNode->tqparent; + parentNode = currentNode->parent; Tag *tag = 0L; TQTag *qTag = 0L; textLine.append(write->text(startLine, startCol, startLine, write->editIf->lineLength(startLine))); @@ -151,7 +151,7 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No //create a toplevel node for the special area AreaStruct area(line, specialStartPos, line, specialStartPos + foundText.length() - 1); Node *node = ParserCommon::createScriptTagNode(write, area, foundText, m_dtd, parentNode, currentNode); - if (node->tqparent && node->prev == node->tqparent) //some strange cases, but it's possible, eg.: <a href="<? foo ?>""></a><input size="<? foo ?>" > + if (node->parent && node->prev == node->parent) //some strange cases, but it's possible, eg.: <a href="<? foo ?>""></a><input size="<? foo ?>" > { node->prev->next = 0L; node->prev = 0L; @@ -329,7 +329,7 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No searchFor.remove('/'); if ( qTag->stoppingTags.contains(searchFor)) { - parentNode->tag->closingMissing = true; //tqparent is single... + parentNode->tag->closingMissing = true; //parent is single... goUp = true; } } @@ -353,16 +353,16 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No //handle cases like <ul><li></ul> if (tag->type == Tag::XmlTagEnd && !QuantaCommon::closesTag(parentNode->tag, tag)) { - while ( parentNode->tqparent && - QuantaCommon::closesTag(parentNode->tqparent->tag, tag) + while ( parentNode->parent && + QuantaCommon::closesTag(parentNode->parent->tag, tag) ) { - parentNode = parentNode->tqparent; + parentNode = parentNode->parent; } } else if (qTag && tag->type != Tag::XmlTagEnd) { - //handle the case when a tag is a stopping tag for tqparent, and grandtqparent and so on. + //handle the case when a tag is a stopping tag for parent, and grandparent and so on. Node *n = parentNode; TQString searchFor = (m_dtd->caseSensitive)?tag->name:tag->name.upper(); while (qTag && n) @@ -372,10 +372,10 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No { if ( qTag->stoppingTags.contains(searchFor) ) { - n->tag->closingMissing = true; //tqparent is single... - if (n->tqparent) + n->tag->closingMissing = true; //parent is single... + if (n->parent) parentNode = n; - n = n->tqparent; + n = n->parent; } else { break; @@ -384,11 +384,11 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No } } - node = new Node(parentNode->tqparent); + node = new Node(parentNode->parent); nodeNum++; node->prev = parentNode; parentNode->next = node; - parentNode = parentNode->tqparent; + parentNode = parentNode->parent; node->closesPrevious = true; } else { @@ -621,13 +621,13 @@ Node *Parser::nodeAt(int line, int col, bool findDeepest, bool exact) node = node->child; } else { - if (node->tqparent) + if (node->parent) { int parentEl, parentEc; - node->tqparent->tag->endPos(parentEl, parentEc); + node->parent->tag->endPos(parentEl, parentEc); if (!exact && QuantaCommon::isBetween(line, col, bl, bc, parentEl, parentEc) == 0) { - node = node->tqparent; + node = node->parent; } } break; //we found the node @@ -635,8 +635,8 @@ Node *Parser::nodeAt(int line, int col, bool findDeepest, bool exact) } else if (result == -1) { - if (node->tqparent) - node = node->tqparent; + if (node->parent) + node = node->parent; break; //we found the node } else { @@ -653,9 +653,9 @@ Node *Parser::nodeAt(int line, int col, bool findDeepest, bool exact) if (node && node->tag->type == Tag::Empty && (findDeepest || (bl == el && ec < bc)) ) { - if (node->tqparent) + if (node->parent) { - node = node->tqparent; + node = node->parent; } else if (node->prev) { @@ -807,7 +807,7 @@ bool Parser::invalidArea(Document *w, AreaStruct &area, Node **firstNode, Node * void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) { - Node *nextNode, *child, *tqparent, *next, *prev; + Node *nextNode, *child, *parent, *next, *prev; int i, j; Node *node = firstNode; bool closesPrevious = false; @@ -819,7 +819,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) nextNode = node->nextSibling(); node->removeAll = false; child = node->child; - tqparent = node->tqparent; + parent = node->parent; next = node->next; prev = node->prev; closesPrevious = node->closesPrevious; @@ -827,9 +827,9 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) { nextNode->prev = prev; } - if (nextNode && nextNode->tqparent == node) + if (nextNode && nextNode->parent == node) { - nextNode->tqparent = tqparent; + nextNode->parent = parent; } if (next) next->prev = prev; @@ -845,9 +845,9 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) modif->setLocation(kafkaCommon::getLocation(node)); if (prev && prev->next == node) prev->next = 0L; - if(tqparent && tqparent->child == node) - tqparent->child = 0L; - node->tqparent = 0L; + if(parent && parent->child == node) + parent->child = 0L; + node->parent = 0L; node->next = 0L; node->prev = 0L; @@ -866,11 +866,11 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) while (n) { m = n; - n->tqparent = tqparent; + n->parent = parent; n = n->next; i++; } - //connect the first child to the tree (after prev, or as the first child of the tqparent) + //connect the first child to the tree (after prev, or as the first child of the parent) if (prev && child) { prev->next = child; @@ -882,7 +882,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) } } else { - if (!child) //when there is no child, connect the next as the first child of the tqparent + if (!child) //when there is no child, connect the next as the first child of the parent child = next; else if (next) @@ -893,14 +893,14 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) n->next = next; next->prev = n; } - if (tqparent && !tqparent->child) + if (parent && !parent->child) { - tqparent->child = child; + parent->child = child; } } } else { - //change the tqparent of tqchildren, so the prev will be the new tqparent + //change the parent of tqchildren, so the prev will be the new parent if (child) { Node *n = child; @@ -908,7 +908,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) while (n) { m = n; - n->tqparent = prev; + n->parent = prev; n = n->next; i++; } @@ -953,7 +953,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) Node *n = next; while (n) { - n->tqparent = prev; + n->parent = prev; n = n->next; j++; } @@ -1053,8 +1053,8 @@ Node *Parser::rebuild(Document *w) { if (lastNode->prev ) lastNode->prev->next = 0L; - if (lastNode->tqparent && lastNode->tqparent->child == lastNode) - lastNode->tqparent->child = 0L; + if (lastNode->parent && lastNode->parent->child == lastNode) + lastNode->parent->child = 0L; } Node::deleteNode(lastNode); nodeNum--; @@ -1077,7 +1077,7 @@ Node *Parser::rebuild(Document *w) lastNode->prev = lastInserted->prev; if (lastInserted->prev) lastInserted->prev->next = lastNode; - lastNode->tqparent = lastInserted->tqparent; + lastNode->parent = lastInserted->parent; lastInserted->tag->beginPos(area.bLine, area.bCol); lastNode->tag->endPos(area.eLine, area.eCol); Tag *_tag = new Tag(*(lastNode->tag)); @@ -1091,9 +1091,9 @@ Node *Parser::rebuild(Document *w) { lastNode->tag->type = Tag::Empty; } - if (lastInserted->tqparent && lastInserted->tqparent->child == lastInserted) - //lastInserted->tqparent->child = lastInserted->next; lastInserted has no next! - lastInserted->tqparent->child = lastNode; + if (lastInserted->parent && lastInserted->parent->child == lastInserted) + //lastInserted->parent->child = lastInserted->next; lastInserted has no next! + lastInserted->parent->child = lastNode; //here, lastNode is at the pos of lastInserted. modif = new NodeModif(); @@ -1102,11 +1102,11 @@ Node *Parser::rebuild(Document *w) if(lastInserted->prev) lastInserted->prev->next = 0L; - if(lastInserted->tqparent && lastInserted->tqparent->child == lastInserted) - lastInserted->tqparent->child = 0L; + if(lastInserted->parent && lastInserted->parent->child == lastInserted) + lastInserted->parent->child = 0L; lastInserted->prev = 0L; lastInserted->next = 0L; - lastInserted->tqparent = 0L; + lastInserted->parent = 0L; lastInserted->child = 0L; // delete lastInserted; @@ -1132,46 +1132,46 @@ Node *Parser::rebuild(Document *w) { // kdDebug(24000) << "lastNode6: " << lastNode << " " << lastNode->tag << endl; qTag = 0L; - goUp = ( node->tqparent && - ( (lastNode->tag->type == Tag::XmlTagEnd && QuantaCommon::closesTag(node->tqparent->tag, lastNode->tag) ) || - node->tqparent->tag->single ) + goUp = ( node->parent && + ( (lastNode->tag->type == Tag::XmlTagEnd && QuantaCommon::closesTag(node->parent->tag, lastNode->tag) ) || + node->parent->tag->single ) ); - if (node->tqparent && !goUp) + if (node->parent && !goUp) { - qTag = QuantaCommon::tagFromDTD(m_dtd, node->tqparent->tag->name); + qTag = QuantaCommon::tagFromDTD(m_dtd, node->parent->tag->name); if ( qTag ) { TQString searchFor = (m_dtd->caseSensitive)?lastNode->tag->name:lastNode->tag->name.upper(); searchFor.remove('/'); if ( qTag->stoppingTags.contains( searchFor ) ) { - node->tqparent->tag->closingMissing = true; //tqparent is single... + node->parent->tag->closingMissing = true; //parent is single... goUp = true; } } } if (goUp && - ( (m_dtd->caseSensitive && node->tag->name == node->tqparent->tag->name) || - (!m_dtd->caseSensitive && node->tag->name.lower() == node->tqparent->tag->name.lower())) ) - goUp = false; //it can happen that the tag closes the previous and not the tqparent + ( (m_dtd->caseSensitive && node->tag->name == node->parent->tag->name) || + (!m_dtd->caseSensitive && node->tag->name.lower() == node->parent->tag->name.lower())) ) + goUp = false; //it can happen that the tag closes the previous and not the parent - if (goUp) //lastnode closes the node->tqparent + if (goUp) //lastnode closes the node->parent { //handle cases like <ul><li></ul> if (lastNode->tag->type == Tag::XmlTagEnd && - !QuantaCommon::closesTag(node->tqparent->tag, lastNode->tag)) + !QuantaCommon::closesTag(node->parent->tag, lastNode->tag)) { - while ( node->tqparent->tqparent && - QuantaCommon::closesTag(node->tqparent->tqparent->tag, lastNode->tag) + while ( node->parent->parent && + QuantaCommon::closesTag(node->parent->parent->tag, lastNode->tag) ) { - node = node->tqparent; + node = node->parent; } } else if (qTag && lastNode->tag->type != Tag::XmlTagEnd) { - //handle the case when a tag is a stopping tag for tqparent, and grandtqparent and so on. I'm not sure it's needed here, but anyway... - Node *n = node->tqparent; + //handle the case when a tag is a stopping tag for parent, and grandparent and so on. I'm not sure it's needed here, but anyway... + Node *n = node->parent; TQString searchFor = (m_dtd->caseSensitive) ? lastNode->tag->name : lastNode->tag->name.upper(); while (qTag && n) { @@ -1180,10 +1180,10 @@ Node *Parser::rebuild(Document *w) { if ( qTag->stoppingTags.contains(searchFor) ) { - n->tag->closingMissing = true; //tqparent is single... - if (n->tqparent) + n->tag->closingMissing = true; //parent is single... + if (n->parent) node = n; - n = n->tqparent; + n = n->parent; } else { break; @@ -1193,15 +1193,15 @@ Node *Parser::rebuild(Document *w) } if (lastNode->prev && lastNode->prev->next == lastNode) lastNode->prev->next = 0L; - if (lastNode->tqparent && lastNode->tqparent->child == lastNode) - lastNode->tqparent->child = 0L; - if (node->tqparent) - node->tqparent->next = lastNode; - lastNode->prev = node->tqparent; - if (node->tqparent) - lastNode->tqparent = node->tqparent->tqparent; + if (lastNode->parent && lastNode->parent->child == lastNode) + lastNode->parent->child = 0L; + if (node->parent) + node->parent->next = lastNode; + lastNode->prev = node->parent; + if (node->parent) + lastNode->parent = node->parent->parent; else - lastNode->tqparent = 0L; + lastNode->parent = 0L; node->next = 0L; lastNode->closesPrevious = true; } else @@ -1210,7 +1210,7 @@ Node *Parser::rebuild(Document *w) lastNode->prev->next = 0L; node->next = lastNode; lastNode->prev = node; - lastNode->tqparent = node->tqparent; + lastNode->parent = node->parent; // kdDebug(24000) << "lastNode7: " << lastNode << " " << lastNode->tag << endl; } node = lastNode; |