summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-03-26 09:55:48 (GMT)
committerRoberto Raggi <roberto.raggi@nokia.com>2010-03-26 09:57:33 (GMT)
commit31b972b12db4497f1c3ba1762d784c7315e75b62 (patch)
tree81c4a15ff67120e9a5cdd293f73f284028b5aa4b /src
parenta034773ce0e9d3fe3e7768da248d8c2e99cf132d (diff)
downloadQt-31b972b12db4497f1c3ba1762d784c7315e75b62.zip
Qt-31b972b12db4497f1c3ba1762d784c7315e75b62.tar.gz
Qt-31b972b12db4497f1c3ba1762d784c7315e75b62.tar.bz2
Recompute the source location of regexp literals.
Task-number: QTBUG-9367
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/parser/qdeclarativejs.g8
-rw-r--r--src/declarative/qml/parser/qdeclarativejsparser.cpp8
2 files changed, 14 insertions, 2 deletions
diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g
index 0256c52..c7524a4 100644
--- a/src/declarative/qml/parser/qdeclarativejs.g
+++ b/src/declarative/qml/parser/qdeclarativejs.g
@@ -656,7 +656,7 @@ case $rule_number: {
} else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {
QString text;
for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) {
- text += q->name->asString();
+ text += q->name->asString();
if (q->next) text += QLatin1String(".");
}
node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
@@ -1109,6 +1109,9 @@ case $rule_number: {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
return false; // ### remove me
}
+
+ loc(1).length = lexer->tokenLength();
+
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
node->literalToken = loc(1);
sym(1).Node = node;
@@ -1126,6 +1129,9 @@ case $rule_number: {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
return false;
}
+
+ loc(1).length = lexer->tokenLength();
+
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
node->literalToken = loc(1);
sym(1).Node = node;
diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp
index 9205ef4..2949e88 100644
--- a/src/declarative/qml/parser/qdeclarativejsparser.cpp
+++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp
@@ -275,7 +275,7 @@ case 20: {
} else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {
QString text;
for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) {
- text += q->name->asString();
+ text += q->name->asString();
if (q->next) text += QLatin1String(".");
}
node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
@@ -571,6 +571,9 @@ case 76: {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
return false; // ### remove me
}
+
+ loc(1).length = lexer->tokenLength();
+
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
node->literalToken = loc(1);
sym(1).Node = node;
@@ -582,6 +585,9 @@ case 77: {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
return false;
}
+
+ loc(1).length = lexer->tokenLength();
+
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
node->literalToken = loc(1);
sym(1).Node = node;