Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
9be3ab0f
Commit
9be3ab0f
authored
Oct 01, 2009
by
Erik Verbruggen
Browse files
Copied in a new version of the QML parser from Qt Kinetic.
parent
df9e5027
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmleditor/parser/qmljs.g
View file @
9be3ab0f
...
...
@@ -89,6 +89,7 @@
--- feed tokens
%token T_FEED_UI_PROGRAM
%token T_FEED_UI_OBJECT_MEMBER
%token T_FEED_JS_STATEMENT
%token T_FEED_JS_EXPRESSION
...
...
@@ -285,6 +286,7 @@ public:
bool parse() { return parse(T_FEED_UI_PROGRAM); }
bool parseStatement() { return parse(T_FEED_JS_STATEMENT); }
bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); }
bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); }
AST::UiProgram *ast() const
{ return AST::cast<AST::UiProgram *>(program); }
...
...
@@ -305,6 +307,14 @@ public:
return program->expressionCast();
}
AST::UiObjectMember *uiObjectMember() const
{
if (! program)
return 0;
return program->uiObjectMemberCast();
}
QList<DiagnosticMessage> diagnosticMessages() const
{ return diagnostic_messages; }
...
...
@@ -550,6 +560,14 @@ case $rule_number: {
} break;
./
TopLevel: T_FEED_UI_OBJECT_MEMBER UiObjectMember ;
/.
case $rule_number: {
sym(1).Node = sym(2).Node;
program = sym(1).Node;
} break;
./
UiProgram: UiImportListOpt UiRootMember ;
/.
case $rule_number: {
...
...
@@ -850,6 +868,21 @@ case $rule_number: {
} break;
./
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT T_IDENTIFIER T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
node->typeModifier = sym(2).sval;
node->propertyToken = loc(1);
node->typeModifierToken = loc(2);
node->typeToken = loc(4);
node->identifierToken = loc(6);
node->semicolonToken = loc(7);
sym(1).Node = node;
} break;
./
UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_SEMICOLON ;
/.
...
...
src/plugins/qmleditor/parser/qmljsast.cpp
View file @
9be3ab0f
...
...
@@ -75,6 +75,11 @@ Statement *Node::statementCast()
return
0
;
}
UiObjectMember
*
Node
::
uiObjectMemberCast
()
{
return
0
;
}
ExpressionNode
*
ExpressionNode
::
expressionCast
()
{
return
this
;
...
...
@@ -90,6 +95,11 @@ Statement *Statement::statementCast()
return
this
;
}
UiObjectMember
*
UiObjectMember
::
uiObjectMemberCast
()
{
return
this
;
}
void
NestedExpression
::
accept0
(
Visitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
...
...
src/plugins/qmleditor/parser/qmljsast_p.h
View file @
9be3ab0f
...
...
@@ -228,6 +228,7 @@ public:
virtual
ExpressionNode
*
expressionCast
();
virtual
BinaryExpression
*
binaryExpressionCast
();
virtual
Statement
*
statementCast
();
virtual
UiObjectMember
*
uiObjectMemberCast
();
void
accept
(
Visitor
*
visitor
);
static
void
accept
(
Node
*
node
,
Visitor
*
visitor
);
...
...
@@ -2356,6 +2357,8 @@ class UiObjectMember: public Node
public:
virtual
SourceLocation
firstSourceLocation
()
const
=
0
;
virtual
SourceLocation
lastSourceLocation
()
const
=
0
;
virtual
UiObjectMember
*
uiObjectMemberCast
();
};
class
UiObjectMemberList
:
public
Node
...
...
@@ -2481,13 +2484,13 @@ public:
UiPublicMember
(
NameId
*
memberType
,
NameId
*
name
)
:
type
(
Property
),
memberType
(
memberType
),
name
(
name
),
expression
(
0
),
isDefaultMember
(
false
),
isReadonlyMember
(
false
),
parameters
(
0
)
:
type
(
Property
),
typeModifier
(
0
),
memberType
(
memberType
),
name
(
name
),
expression
(
0
),
isDefaultMember
(
false
),
isReadonlyMember
(
false
),
parameters
(
0
)
{
kind
=
K
;
}
UiPublicMember
(
NameId
*
memberType
,
NameId
*
name
,
ExpressionNode
*
expression
)
:
type
(
Property
),
memberType
(
memberType
),
name
(
name
),
expression
(
expression
),
isDefaultMember
(
false
),
isReadonlyMember
(
false
),
parameters
(
0
)
:
type
(
Property
),
typeModifier
(
0
),
memberType
(
memberType
),
name
(
name
),
expression
(
expression
),
isDefaultMember
(
false
),
isReadonlyMember
(
false
),
parameters
(
0
)
{
kind
=
K
;
}
virtual
SourceLocation
firstSourceLocation
()
const
...
...
@@ -2509,6 +2512,7 @@ public:
// attributes
enum
{
Signal
,
Property
}
type
;
NameId
*
typeModifier
;
NameId
*
memberType
;
NameId
*
name
;
ExpressionNode
*
expression
;
...
...
@@ -2518,6 +2522,7 @@ public:
SourceLocation
defaultToken
;
SourceLocation
readonlyToken
;
SourceLocation
propertyToken
;
SourceLocation
typeModifierToken
;
SourceLocation
typeToken
;
SourceLocation
identifierToken
;
SourceLocation
colonToken
;
...
...
src/plugins/qmleditor/parser/qmljsastvisitor.cpp
View file @
9be3ab0f
...
...
@@ -41,7 +41,7 @@
#include "qmljsastvisitor_p.h"
QT_
QML_
BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE
namespace
QmlJS
{
namespace
AST
{
...
...
@@ -55,4 +55,4 @@ Visitor::~Visitor()
}
}
// namespace QmlJS::AST
QT_
QML_
END_NAMESPACE
QT_END_NAMESPACE
src/plugins/qmleditor/parser/qmljsgrammar.cpp
View file @
9be3ab0f
This diff is collapsed.
Click to expand it.
src/plugins/qmleditor/parser/qmljsgrammar_p.h
View file @
9be3ab0f
...
...
@@ -2,6 +2,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
...
...
@@ -21,10 +22,9 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
** package.
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
...
...
@@ -59,8 +59,8 @@ class QmlJSGrammar
public:
enum
{
EOF_SYMBOL
=
0
,
REDUCE_HERE
=
9
6
,
SHIFT_THERE
=
9
5
,
REDUCE_HERE
=
9
7
,
SHIFT_THERE
=
9
6
,
T_AND
=
1
,
T_AND_AND
=
2
,
T_AND_EQ
=
3
,
...
...
@@ -86,8 +86,9 @@ public:
T_EQ_EQ
=
18
,
T_EQ_EQ_EQ
=
19
,
T_FALSE
=
83
,
T_FEED_JS_EXPRESSION
=
94
,
T_FEED_JS_STATEMENT
=
93
,
T_FEED_JS_EXPRESSION
=
95
,
T_FEED_JS_STATEMENT
=
94
,
T_FEED_UI_OBJECT_MEMBER
=
93
,
T_FEED_UI_PROGRAM
=
92
,
T_FINALLY
=
20
,
T_FOR
=
21
,
...
...
@@ -156,15 +157,15 @@ public:
T_XOR
=
79
,
T_XOR_EQ
=
80
,
ACCEPT_STATE
=
6
21
,
RULE_COUNT
=
3
37
,
STATE_COUNT
=
6
22
,
TERMINAL_COUNT
=
9
7
,
ACCEPT_STATE
=
6
30
,
RULE_COUNT
=
3
40
,
STATE_COUNT
=
6
31
,
TERMINAL_COUNT
=
9
8
,
NON_TERMINAL_COUNT
=
105
,
GOTO_INDEX_OFFSET
=
6
22
,
GOTO_INFO_OFFSET
=
2
402
,
GOTO_CHECK_OFFSET
=
2
402
GOTO_INDEX_OFFSET
=
6
31
,
GOTO_INFO_OFFSET
=
2
618
,
GOTO_CHECK_OFFSET
=
2
618
};
static
const
char
*
const
spell
[];
...
...
src/plugins/qmleditor/parser/qmljsparser.cpp
View file @
9be3ab0f
This diff is collapsed.
Click to expand it.
src/plugins/qmleditor/parser/qmljsparser_p.h
View file @
9be3ab0f
...
...
@@ -133,6 +133,7 @@ public:
bool
parse
()
{
return
parse
(
T_FEED_UI_PROGRAM
);
}
bool
parseStatement
()
{
return
parse
(
T_FEED_JS_STATEMENT
);
}
bool
parseExpression
()
{
return
parse
(
T_FEED_JS_EXPRESSION
);
}
bool
parseUiObjectMember
()
{
return
parse
(
T_FEED_UI_OBJECT_MEMBER
);
}
AST
::
UiProgram
*
ast
()
const
{
return
AST
::
cast
<
AST
::
UiProgram
*>
(
program
);
}
...
...
@@ -153,6 +154,14 @@ public:
return
program
->
expressionCast
();
}
AST
::
UiObjectMember
*
uiObjectMember
()
const
{
if
(
!
program
)
return
0
;
return
program
->
uiObjectMemberCast
();
}
QList
<
DiagnosticMessage
>
diagnosticMessages
()
const
{
return
diagnostic_messages
;
}
...
...
@@ -222,9 +231,9 @@ protected:
#define J_SCRIPT_REGEXPLITERAL_RULE1
69
#define J_SCRIPT_REGEXPLITERAL_RULE1
72
#define J_SCRIPT_REGEXPLITERAL_RULE2 7
0
#define J_SCRIPT_REGEXPLITERAL_RULE2 7
3
QT_QML_END_NAMESPACE
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment