File indexing completed on 2024-05-19 15:46:17

0001 /*
0002     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef QMAKELEXER_H
0008 #define QMAKELEXER_H
0009 
0010 #include <util/stack.h>
0011 #include <QString>
0012 #include "parser_export.h"
0013 
0014 class QString;
0015 class kdev_pg_location_table;
0016 
0017 namespace QMake
0018 {
0019 
0020 class Parser;
0021 
0022 class KDEVQMAKEPARSER_EXPORT Lexer {
0023 public:
0024     Lexer(Parser* _parser, QString  contents);
0025 
0026     int nextTokenKind();
0027     qint64 tokenBegin() const;
0028     qint64 tokenEnd() const;
0029 
0030 private:
0031     QString m_content;
0032     Parser* m_parser;
0033     int m_curpos;
0034     int m_contentSize;
0035     qint64 m_tokenBegin;
0036     qint64 m_tokenEnd;
0037 
0038     int state() const;
0039     void pushState(int state);
0040     void popState();
0041 
0042     QChar* ignoreWhitespaceAndComment(QChar* it);
0043     void createNewline( int pos );
0044 
0045     KDevelop::Stack<int> mState;
0046     enum State
0047     {
0048         ErrorState = -1,
0049         DefaultState = 0,
0050         ContState = 2,
0051         VariableValueState = 4,
0052         FunctionArgState = 5
0053     };
0054 
0055 };
0056 
0057 }
0058 
0059 #endif
0060