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

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

namespace NSQLComplete {

    TMaybe<std::string> GetId(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