File indexing completed on 2024-04-21 05:51:37
0001 /* 0002 * SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-only 0005 **/ 0006 0007 #ifndef __LOOKAHEADREGEXP_H 0008 #define __LOOKAHEADREGEXP_H 0009 0010 #include "regexp.h" 0011 0012 /** 0013 Abstract syntax node for `repeated content' regular expression 0014 @internal 0015 */ 0016 class LookAheadRegExp : public RegExp 0017 { 0018 public: 0019 enum TYPE { POSITIVE, NEGATIVE }; 0020 0021 LookAheadRegExp(bool selected, TYPE tp, RegExp *child = nullptr); 0022 0023 bool check(ErrorMap &, bool first, bool last) override; 0024 int precedence() const override 0025 { 0026 return 4; 0027 } 0028 0029 QDomNode toXml(QDomDocument *doc) const override; 0030 bool load(const QDomElement &, const QString &version) override; 0031 RegExp *child() const 0032 { 0033 return _child; 0034 } 0035 0036 TYPE lookAheadType() const 0037 { 0038 return _tp; 0039 } 0040 0041 RegExpType type() const override 0042 { 0043 return LOOKAHEAD; 0044 } 0045 0046 bool operator==(const RegExp &other) const override; 0047 void replacePart(CompoundRegExp *replacement) override 0048 { 0049 _child->replacePart(replacement); 0050 } 0051 0052 private: 0053 RegExp *_child = nullptr; 0054 TYPE _tp; 0055 }; 0056 0057 #endif // __LOOKAHEADREGEXP_H