File indexing completed on 2024-04-14 05:44:25

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 __POSITIONREGEXP_H
0008 #define __POSITIONREGEXP_H
0009 
0010 #include "regexp.h"
0011 
0012 /**
0013    Abstract syntax node for `positions' regular expression
0014    @internal
0015 */
0016 class PositionRegExp : public RegExp
0017 {
0018 public:
0019     enum PositionType { BEGLINE, ENDLINE, WORDBOUNDARY, NONWORDBOUNDARY };
0020 
0021     PositionRegExp(bool selected, PositionType tp);
0022     PositionType position() const
0023     {
0024         return _tp;
0025     }
0026 
0027     bool check(ErrorMap &, bool first, bool last) override;
0028     int precedence() const override
0029     {
0030         return 4;
0031     }
0032 
0033     QDomNode toXml(QDomDocument *doc) const override;
0034     bool load(const QDomElement &, const QString &version) override;
0035     RegExpType type() const override
0036     {
0037         return POSITION;
0038     }
0039 
0040 private:
0041     PositionType _tp;
0042 };
0043 
0044 #endif // __POSITIONREGEXP_H