aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/haskell/haskelltokenizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/haskell/haskelltokenizer.cpp')
-rw-r--r--plugins/haskell/haskelltokenizer.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/haskell/haskelltokenizer.cpp b/plugins/haskell/haskelltokenizer.cpp
index 527e505..b59b48b 100644
--- a/plugins/haskell/haskelltokenizer.cpp
+++ b/plugins/haskell/haskelltokenizer.cpp
@@ -150,6 +150,19 @@ Tokens::Tokens(std::shared_ptr<QString> source)
{
}
+Token Tokens::tokenAtColumn(int col) const
+{
+ auto it = std::upper_bound(begin(), end(), col, [](int c, const Token &i) {
+ return c < i.startCol;
+ });
+ if (it == begin())
+ return Token();
+ --it;
+ if (it->startCol + it->length > col)
+ return *it;
+ return Token();
+}
+
static int grab(const QString &line, int begin,
const std::function<bool(const QChar&)> &test)
{
@@ -160,7 +173,6 @@ static int grab(const QString &line, int begin,
return current - begin;
};
-
static bool isIdentifierChar(const QChar &c)
{
return c.isLetterOrNumber() || c == '\'' || c == '_';