summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/parser/qmljsengine_p.h
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2011-09-13 08:42:52 +0200
committerChristian Kamm <christian.d.kamm@nokia.com>2011-09-14 11:48:11 +0200
commitb5312090028a338ac3f945f8692cadde7eb2172b (patch)
treed5bc33e28336f9d3f340a49d7536ba7baee0cb20 /src/libs/qmljs/parser/qmljsengine_p.h
parentc0c9312495cab51c753298c02d1f6d57d1daed9e (diff)
downloadqt-creator-b5312090028a338ac3f945f8692cadde7eb2172b.tar.gz
QmlJS: Merge parser updates from Qt5.
Change-Id: Ibed38abca8f7e7bae7d424751a18c83f4c9e9bc5 Reviewed-on: http://codereview.qt-project.org/4732 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/libs/qmljs/parser/qmljsengine_p.h')
-rw-r--r--src/libs/qmljs/parser/qmljsengine_p.h73
1 files changed, 16 insertions, 57 deletions
diff --git a/src/libs/qmljs/parser/qmljsengine_p.h b/src/libs/qmljs/parser/qmljsengine_p.h
index bc601aff51..9297b38ca1 100644
--- a/src/libs/qmljs/parser/qmljsengine_p.h
+++ b/src/libs/qmljs/parser/qmljsengine_p.h
@@ -46,6 +46,7 @@
#include "qmljsglobal_p.h"
#include "qmljsastfwd_p.h"
+#include "qmljsmemorypool_p.h"
#include <QString>
#include <QSet>
@@ -53,54 +54,9 @@
QT_QML_BEGIN_NAMESPACE
namespace QmlJS {
-class QML_PARSER_EXPORT NameId
-{
- QString _text;
-
-public:
- NameId(const QChar *u, int s)
- : _text(u, s)
- { }
-
- const QString asString() const
- { return _text; }
-
- bool operator == (const NameId &other) const
- { return _text == other._text; }
-
- bool operator != (const NameId &other) const
- { return _text != other._text; }
-
- bool operator < (const NameId &other) const
- { return _text < other._text; }
-};
-
-uint qHash(const QmlJS::NameId &id);
-
-} // end of namespace QmlJS
-
-namespace QmlJS {
class Lexer;
-class NodePool;
-
-namespace Ecma {
-
-class QML_PARSER_EXPORT RegExp
-{
-public:
- enum RegExpFlag {
- Global = 0x01,
- IgnoreCase = 0x02,
- Multiline = 0x04
- };
-
-public:
- static int flagFromChar(const QChar &);
- static QString flagsToString(int flags);
-};
-
-} // end of namespace Ecma
+class MemoryPool;
class QML_PARSER_EXPORT DiagnosticMessage
{
@@ -127,30 +83,33 @@ public:
class QML_PARSER_EXPORT Engine
{
Lexer *_lexer;
- NodePool *_nodePool;
- QSet<NameId> _literals;
- QList<QmlJS::AST::SourceLocation> _comments;
+ MemoryPool _pool;
+ QList<AST::SourceLocation> _comments;
+ QString _extraCode;
+ QString _code;
public:
Engine();
~Engine();
- QSet<NameId> literals() const;
+ void setCode(const QString &code);
void addComment(int pos, int len, int line, int col);
- QList<QmlJS::AST::SourceLocation> comments() const;
-
- NameId *intern(const QChar *u, int s);
-
- static QString toString(NameId *id);
+ QList<AST::SourceLocation> comments() const;
Lexer *lexer() const;
void setLexer(Lexer *lexer);
- NodePool *nodePool() const;
- void setNodePool(NodePool *nodePool);
+ MemoryPool *pool();
+
+ inline QStringRef midRef(int position, int size) { return _code.midRef(position, size); }
+
+ QStringRef newStringRef(const QString &s);
+ QStringRef newStringRef(const QChar *chars, int size);
};
+double integerFromString(const char *buf, int size, int radix);
+
} // end of namespace QmlJS
QT_QML_END_NAMESPACE