blob: 5eae94273bfad79018100231476aa3839836df04 (
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
 | #include "lexer.h"
#include "lexer_detail.h"
#include "token.h"
#include <util/generic/ptr.h>
namespace NYson {
    ////////////////////////////////////////////////////////////////////////////////
    class TStatelessLexer::TImpl {
    private:
        THolder<TStatelessYsonLexerImplBase> Impl;
    public:
        TImpl(bool enableLinePositionInfo = false)
            : Impl(enableLinePositionInfo
                       ? static_cast<TStatelessYsonLexerImplBase*>(new TStatelesYsonLexerImpl<true>())
                       : static_cast<TStatelessYsonLexerImplBase*>(new TStatelesYsonLexerImpl<false>()))
                   {
        }
        size_t GetToken(const TStringBuf& data, TToken* token) {
            return Impl->GetToken(data, token);
        }
    };
    ////////////////////////////////////////////////////////////////////////////////
    TStatelessLexer::TStatelessLexer()
        : Impl(new TImpl())
    {
    }
    TStatelessLexer::~TStatelessLexer() {
    }
    size_t TStatelessLexer::GetToken(const TStringBuf& data, TToken* token) {
        return Impl->GetToken(data, token);
    }
    ////////////////////////////////////////////////////////////////////////////////
} // namespace NYson
 |