summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/complete/analysis/global/parse_tree.cpp
blob: b14dba9220ec4fac7f84b055b586f97acf4b5e76 (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
#include "parse_tree.h"

#include <yql/essentials/sql/v1/complete/syntax/format.h>

#include <util/system/yassert.h>
#include <util/generic/maybe.h>

namespace NSQLComplete {

TMaybe<std::string> GetName(SQLv1::Bind_parameterContext* ctx) {
    if (ctx == nullptr) {
        return Nothing();
    }

    if (auto* x = ctx->an_id_or_type()) {
        return x->getText();
    } else if (auto* x = ctx->TOKEN_TRUE()) {
        return x->getText();
    } else if (auto* x = ctx->TOKEN_FALSE()) {
        return x->getText();
    } else {
        return Nothing();
    }
}

} // namespace NSQLComplete