aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.cpp
blob: 22fc531f19b6e7ccf82f88263af34335e7441fa4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "parsererror.h"
#include "token.h"

ParserError::ParserError(TokenPtr token, const QString &text)
{
    if (token)
    {
        start = token->start;
        end = token->end;
    }
    message = text;
}

ParserError::ParserError(qint64 start, qint64 end, const QString& text) :
    message(text),
    start(start),
    end(end)
{
}

ParserError::ParserError(const QString &text)
{
    message = text;
}

QString &ParserError::getMessage()
{
    return message;
}

qint64 ParserError::getFrom()
{
    return start;
}

qint64 ParserError::getTo()
{
    return end;
}

QString ParserError::toString()
{
    return QString("%1: %2").arg(start).arg(message);
}