forked from qt-creator/qt-creator
Changed the QScriptHighlighter & QScriptIndenter namespaces.
This commit is contained in:
@@ -5,7 +5,8 @@ contains(CONFIG, dll) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
include(parser/parser.pri)
|
include(parser/parser.pri)
|
||||||
include($$PWD/qscripthighlighter.pri)
|
|
||||||
|
DEFINES += QSCRIPTHIGHLIGHTER_BUILD_LIB
|
||||||
|
|
||||||
DEPENDPATH += $$PWD
|
DEPENDPATH += $$PWD
|
||||||
INCLUDEPATH += $$PWD/..
|
INCLUDEPATH += $$PWD/..
|
||||||
@@ -17,7 +18,8 @@ HEADERS += \
|
|||||||
$$PWD/qmlpackageinfo.h \
|
$$PWD/qmlpackageinfo.h \
|
||||||
$$PWD/qmlsymbol.h \
|
$$PWD/qmlsymbol.h \
|
||||||
$$PWD/qmlmetatypebackend.h \
|
$$PWD/qmlmetatypebackend.h \
|
||||||
$$PWD/qmltypesystem.h
|
$$PWD/qmltypesystem.h \
|
||||||
|
$$PWD/qscriptincrementalscanner.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/qmlidcollector.cpp \
|
$$PWD/qmlidcollector.cpp \
|
||||||
@@ -25,7 +27,8 @@ SOURCES += \
|
|||||||
$$PWD/qmlsymbol.cpp \
|
$$PWD/qmlsymbol.cpp \
|
||||||
$$PWD/qmlpackageinfo.cpp \
|
$$PWD/qmlpackageinfo.cpp \
|
||||||
$$PWD/qmlmetatypebackend.cpp \
|
$$PWD/qmlmetatypebackend.cpp \
|
||||||
$$PWD/qmltypesystem.cpp
|
$$PWD/qmltypesystem.cpp \
|
||||||
|
$$PWD/qscriptincrementalscanner.cpp
|
||||||
|
|
||||||
contains(QT_CONFIG, declarative) {
|
contains(QT_CONFIG, declarative) {
|
||||||
QT += declarative
|
QT += declarative
|
||||||
@@ -39,3 +42,7 @@ contains(QT_CONFIG, declarative) {
|
|||||||
$$PWD/qtdeclarativemetatypebackend.cpp
|
$$PWD/qtdeclarativemetatypebackend.cpp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contains(QT, gui) {
|
||||||
|
SOURCES += $$PWD/qscripthighlighter.cpp $$PWD/qscriptindenter.cpp
|
||||||
|
HEADERS += $$PWD/qscripthighlighter.h $$PWD/qscriptindenter.h
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,12 +27,12 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qscripthighlighter.h"
|
#include <qmljs/qscripthighlighter.h>
|
||||||
|
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QtAlgorithms>
|
#include <QtCore/QtAlgorithms>
|
||||||
|
|
||||||
using namespace SharedTools;
|
using namespace QmlJS;
|
||||||
|
|
||||||
QScriptHighlighter::QScriptHighlighter(bool duiEnabled, QTextDocument *parent):
|
QScriptHighlighter::QScriptHighlighter(bool duiEnabled, QTextDocument *parent):
|
||||||
QSyntaxHighlighter(parent),
|
QSyntaxHighlighter(parent),
|
||||||
|
|||||||
@@ -30,15 +30,15 @@
|
|||||||
#ifndef QSCRIPTSYNTAXHIGHLIGHTER_H
|
#ifndef QSCRIPTSYNTAXHIGHLIGHTER_H
|
||||||
#define QSCRIPTSYNTAXHIGHLIGHTER_H
|
#define QSCRIPTSYNTAXHIGHLIGHTER_H
|
||||||
|
|
||||||
#include <qscripthighlighter/qscriptincrementalscanner.h>
|
#include <qmljs/qscriptincrementalscanner.h>
|
||||||
|
|
||||||
#include <QtCore/QVector>
|
#include <QtCore/QVector>
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtGui/QSyntaxHighlighter>
|
#include <QtGui/QSyntaxHighlighter>
|
||||||
|
|
||||||
namespace SharedTools {
|
namespace QmlJS {
|
||||||
|
|
||||||
class QScriptHighlighter : public QSyntaxHighlighter
|
class QML_EXPORT QScriptHighlighter : public QSyntaxHighlighter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -79,6 +79,6 @@ private:
|
|||||||
QTextCharFormat m_formats[NumFormats];
|
QTextCharFormat m_formats[NumFormats];
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace SharedTools
|
} // namespace QmlJS
|
||||||
|
|
||||||
#endif // QSCRIPTSYNTAXHIGHLIGHTER_H
|
#endif // QSCRIPTSYNTAXHIGHLIGHTER_H
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
INCLUDEPATH *= $$PWD $$PWD/..
|
|
||||||
|
|
||||||
DEFINES += QSCRIPTHIGHLIGHTER_BUILD_LIB
|
|
||||||
|
|
||||||
SOURCES += $$PWD/qscriptincrementalscanner.cpp
|
|
||||||
HEADERS += $$PWD/qscriptincrementalscanner.h
|
|
||||||
|
|
||||||
contains(QT, gui) {
|
|
||||||
SOURCES += $$PWD/qscripthighlighter.cpp $$PWD/qscriptindenter.cpp
|
|
||||||
HEADERS += $$PWD/qscripthighlighter.h $$PWD/qscriptindenter.h
|
|
||||||
}
|
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qscriptincrementalscanner.h"
|
#include <qmljs/qscriptincrementalscanner.h>
|
||||||
|
|
||||||
#include <QTextCharFormat>
|
#include <QTextCharFormat>
|
||||||
|
|
||||||
using namespace SharedTools;
|
using namespace QmlJS;
|
||||||
|
|
||||||
QScriptIncrementalScanner::QScriptIncrementalScanner()
|
QScriptIncrementalScanner::QScriptIncrementalScanner()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,13 +30,15 @@
|
|||||||
#ifndef QSCRIPTINCREMENTALSCANNER_H
|
#ifndef QSCRIPTINCREMENTALSCANNER_H
|
||||||
#define QSCRIPTINCREMENTALSCANNER_H
|
#define QSCRIPTINCREMENTALSCANNER_H
|
||||||
|
|
||||||
|
#include <qmljs/qml_global.h>
|
||||||
|
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
|
||||||
namespace SharedTools {
|
namespace QmlJS {
|
||||||
|
|
||||||
class QScriptIncrementalScanner
|
class QML_EXPORT QScriptIncrementalScanner
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -111,6 +113,6 @@ private:
|
|||||||
QList<QScriptIncrementalScanner::Token> m_tokens;
|
QList<QScriptIncrementalScanner::Token> m_tokens;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace SharedTools
|
} // namespace QmlJS
|
||||||
|
|
||||||
#endif // QSCRIPTINCREMENTALSCANNER_H
|
#endif // QSCRIPTINCREMENTALSCANNER_H
|
||||||
|
|||||||
@@ -65,11 +65,12 @@
|
|||||||
as comments and string literals are removed beforehand.
|
as comments and string literals are removed beforehand.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "qscriptindenter.h"
|
#include <qmljs/qscriptindenter.h>
|
||||||
#include "qscriptincrementalscanner.h"
|
#include <qmljs/qscriptincrementalscanner.h>
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
using namespace SharedTools;
|
using namespace QmlJS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The indenter avoids getting stuck in almost infinite loops by
|
The indenter avoids getting stuck in almost infinite loops by
|
||||||
|
|||||||
@@ -30,14 +30,16 @@
|
|||||||
#ifndef QTSCRIPTINDENTER_H
|
#ifndef QTSCRIPTINDENTER_H
|
||||||
#define QTSCRIPTINDENTER_H
|
#define QTSCRIPTINDENTER_H
|
||||||
|
|
||||||
#include <qscripthighlighter/qscriptincrementalscanner.h>
|
#include <qmljs/qml_global.h>
|
||||||
|
#include <qmljs/qscriptincrementalscanner.h>
|
||||||
|
|
||||||
#include <QtCore/QRegExp>
|
#include <QtCore/QRegExp>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtGui/QTextBlock>
|
#include <QtGui/QTextBlock>
|
||||||
|
|
||||||
namespace SharedTools {
|
namespace QmlJS {
|
||||||
|
|
||||||
class QScriptIndenter
|
class QML_EXPORT QScriptIndenter
|
||||||
{
|
{
|
||||||
Q_DISABLE_COPY(QScriptIndenter)
|
Q_DISABLE_COPY(QScriptIndenter)
|
||||||
|
|
||||||
@@ -132,7 +134,7 @@ private:
|
|||||||
QRegExp iflikeKeyword;
|
QRegExp iflikeKeyword;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace SharedTools
|
} // namespace QmlJS
|
||||||
|
|
||||||
#endif // QTSCRIPTINDENTER_H
|
#endif // QTSCRIPTINDENTER_H
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ using namespace QmlJSEditor;
|
|||||||
using namespace QmlJSEditor::Internal;
|
using namespace QmlJSEditor::Internal;
|
||||||
|
|
||||||
QmlHighlighter::QmlHighlighter(QTextDocument *parent) :
|
QmlHighlighter::QmlHighlighter(QTextDocument *parent) :
|
||||||
SharedTools::QScriptHighlighter(true, parent)
|
QmlJS::QScriptHighlighter(true, parent)
|
||||||
{
|
{
|
||||||
m_currentBlockParentheses.reserve(20);
|
m_currentBlockParentheses.reserve(20);
|
||||||
m_braceDepth = 0;
|
m_braceDepth = 0;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#ifndef QMLSYNTAXHIGHLIGHTER_H
|
#ifndef QMLSYNTAXHIGHLIGHTER_H
|
||||||
#define QMLSYNTAXHIGHLIGHTER_H
|
#define QMLSYNTAXHIGHLIGHTER_H
|
||||||
|
|
||||||
#include <qscripthighlighter/qscripthighlighter.h>
|
#include <qmljs/qscripthighlighter.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
@@ -40,7 +40,7 @@ namespace Internal {
|
|||||||
// the parentheses encountered in the block data
|
// the parentheses encountered in the block data
|
||||||
// for parentheses matching to work.
|
// for parentheses matching to work.
|
||||||
|
|
||||||
class QmlHighlighter : public SharedTools::QScriptHighlighter
|
class QmlHighlighter : public QmlJS::QScriptHighlighter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "qmllookupcontext.h"
|
#include "qmllookupcontext.h"
|
||||||
#include "qmlresolveexpression.h"
|
#include "qmlresolveexpression.h"
|
||||||
|
|
||||||
#include <qscripthighlighter/qscriptindenter.h>
|
#include <qmljs/qscriptindenter.h>
|
||||||
|
|
||||||
#include <qmljs/qmltypesystem.h>
|
#include <qmljs/qmltypesystem.h>
|
||||||
#include <qmljs/parser/qmljsastvisitor_p.h>
|
#include <qmljs/parser/qmljsastvisitor_p.h>
|
||||||
@@ -77,7 +77,6 @@ enum {
|
|||||||
using namespace Qml;
|
using namespace Qml;
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
using namespace QmlJS::AST;
|
using namespace QmlJS::AST;
|
||||||
using namespace SharedTools;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
int blockBraceDepth(const QTextBlock &block)
|
int blockBraceDepth(const QTextBlock &block)
|
||||||
@@ -633,7 +632,7 @@ bool QmlJSTextEditor::isClosingBrace(const QList<QScriptIncrementalScanner::Toke
|
|||||||
void QmlJSTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
|
void QmlJSTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
|
||||||
{
|
{
|
||||||
TextEditor::TabSettings ts = tabSettings();
|
TextEditor::TabSettings ts = tabSettings();
|
||||||
SharedTools::QScriptIndenter indenter;
|
QScriptIndenter indenter;
|
||||||
indenter.setTabSize(ts.m_tabSize);
|
indenter.setTabSize(ts.m_tabSize);
|
||||||
indenter.setIndentSize(ts.m_indentSize);
|
indenter.setIndentSize(ts.m_indentSize);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#define QMLJSEDITOR_H
|
#define QMLJSEDITOR_H
|
||||||
|
|
||||||
#include <qmljs/qmldocument.h>
|
#include <qmljs/qmldocument.h>
|
||||||
#include <qscripthighlighter/qscriptincrementalscanner.h>
|
#include <qmljs/qscriptincrementalscanner.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -145,7 +145,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
virtual bool isElectricCharacter(const QChar &ch) const;
|
virtual bool isElectricCharacter(const QChar &ch) const;
|
||||||
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
|
||||||
bool isClosingBrace(const QList<SharedTools::QScriptIncrementalScanner::Token> &tokens) const;
|
bool isClosingBrace(const QList<QmlJS::QScriptIncrementalScanner::Token> &tokens) const;
|
||||||
|
|
||||||
QString wordUnderCursor() const;
|
QString wordUnderCursor() const;
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ TARGET = QmlJSEditor
|
|||||||
include(../../qtcreatorplugin.pri)
|
include(../../qtcreatorplugin.pri)
|
||||||
include(qmljseditor_dependencies.pri)
|
include(qmljseditor_dependencies.pri)
|
||||||
|
|
||||||
include(../../shared/qscripthighlighter/qscripthighlighter.pri)
|
|
||||||
DEPENDPATH += ../../shared/qscripthighlighter
|
|
||||||
|
|
||||||
|
|
||||||
CONFIG += help
|
CONFIG += help
|
||||||
DEFINES += \
|
DEFINES += \
|
||||||
QMLJSEDITOR_LIBRARY \
|
QMLJSEDITOR_LIBRARY \
|
||||||
|
|||||||
Reference in New Issue
Block a user