Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
b19c51d6
Commit
b19c51d6
authored
14 years ago
by
Christian Kamm
Browse files
Options
Downloads
Patches
Plain Diff
QmlJSEditor: Highlight b in 'A on b {' as a property.
Fixes
4f1d5ce1
Task-number: QTCREATORBUG-893 Reviewed-by: Erik Verbruggen
parent
db2f91ef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/qmljseditor/qmljshighlighter.cpp
+17
-2
17 additions, 2 deletions
src/plugins/qmljseditor/qmljshighlighter.cpp
with
17 additions
and
2 deletions
src/plugins/qmljseditor/qmljshighlighter.cpp
+
17
−
2
View file @
b19c51d6
...
...
@@ -147,11 +147,26 @@ void Highlighter::highlightBlock(const QString &text)
if
(
index
+
1
<
tokens
.
size
())
{
const
Token
&
nextToken
=
tokens
.
at
(
index
+
1
);
bool
maybeBinding
=
(
index
==
0
||
checkStartOfBinding
(
tokens
.
at
(
index
-
1
)));
bool
maybeOnBinding
=
false
;
if
(
index
>
0
)
{
const
Token
&
previousToken
=
tokens
.
at
(
index
-
1
);
if
(
text
.
midRef
(
previousToken
.
offset
,
previousToken
.
length
)
==
QLatin1String
(
"on"
))
{
maybeOnBinding
=
true
;
maybeBinding
=
false
;
}
}
if
(
text
.
at
(
token
.
offset
).
isUpper
()
&&
(
nextToken
.
is
(
Token
::
LeftBrace
)
||
text
.
midRef
(
nextToken
.
offset
,
nextToken
.
length
)
==
QLatin1String
(
"on"
)))
{
setFormat
(
token
.
offset
,
token
.
length
,
m_formats
[
TypeFormat
]);
}
else
if
(
index
==
0
||
checkStartOfBinding
(
tokens
.
at
(
index
-
1
)))
{
}
else
if
(
maybeBinding
||
maybeOnBinding
)
{
Token
::
Kind
expectedTerminator
=
Token
::
Colon
;
if
(
maybeOnBinding
)
expectedTerminator
=
Token
::
LeftBrace
;
const
int
start
=
index
;
++
index
;
// skip the identifier.
...
...
@@ -161,7 +176,7 @@ void Highlighter::highlightBlock(const QString &text)
index
+=
2
;
}
if
(
index
<
tokens
.
size
()
&&
tokens
.
at
(
index
).
is
(
Token
::
Colon
))
{
if
(
index
<
tokens
.
size
()
&&
tokens
.
at
(
index
).
is
(
expectedTerminator
))
{
// it's a binding.
for
(
int
i
=
start
;
i
<
index
;
++
i
)
{
const
Token
&
tok
=
tokens
.
at
(
i
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment