Commit 42c676d1 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Added BackwardsScanner::mid(tokenIndex). Mid() returns a substring starting...

Added BackwardsScanner::mid(tokenIndex). Mid() returns a substring starting from the position of the given token.
parent 41118d91
......@@ -99,6 +99,12 @@ int BackwardsScanner::startPosition() const
QString BackwardsScanner::text() const
{ return _text; }
QString BackwardsScanner::mid(int index) const
const SimpleToken &firstToken = + _offset);
return _text.mid(firstToken.begin());
QString BackwardsScanner::text(int index) const
const SimpleToken &firstToken = + _offset);
......@@ -51,9 +51,10 @@ public:
int startPosition() const;
QString text() const;
QString mid(int index) const;
QString text(int index) const;
QStringRef textRef(int index) const;
// 1-based
SimpleToken LA(int index) const;
......@@ -150,7 +150,7 @@ QString ExpressionUnderCursor::operator()(const QTextCursor &cursor)
if (i == initialSize)
return QString();
return scanner.text(i);
return scanner.mid(i);
int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor) const
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment