Kea 2.5.8
master_lexer_state.h
Go to the documentation of this file.
1// Copyright (C) 2012-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef MASTER_LEXER_STATE_H
8#define MASTER_LEXER_STATE_H
9
10#include <dns/master_lexer.h>
11
12namespace isc {
13namespace dns {
14
15namespace master_lexer_internal {
16
48class State {
49public:
54 virtual ~State() {}
55
69 static const State* start(MasterLexer& lexer,
70 MasterLexer::Options options);
71
84 virtual void handle(MasterLexer& lexer) const = 0;
85
91 enum ID {
95 Number
96 };
97
103 static const State& getInstance(ID state_id);
104
111 bool wasLastEOL(const MasterLexer& lexer) const;
112 const MasterToken& getToken(const MasterLexer& lexer) const;
113 size_t getParenCount(const MasterLexer& lexer) const;
115
116protected:
126 MasterLexer::MasterLexerImpl* getLexerImpl(MasterLexer& lexer) const {
127 return (lexer.impl_.get());
128 }
129};
130
131} // namespace master_lexer_internal
132} // namespace dns
133} // namespace isc
134#endif // MASTER_LEXER_STATE_H
Tokenizer for parsing DNS master files.
Definition: master_lexer.h:303
Options
Options for getNextToken.
Definition: master_lexer.h:345
Tokens for MasterLexer.
Definition: master_lexer.h:40
Tokenization state for MasterLexer.
virtual void handle(MasterLexer &lexer) const =0
Handle the process of one specific state.
size_t getParenCount(const MasterLexer &lexer) const
MasterLexer::MasterLexerImpl * getLexerImpl(MasterLexer &lexer) const
An accessor to the internal implementation class of MasterLexer.
static const State * start(MasterLexer &lexer, MasterLexer::Options options)
Begin state transitions to get the next token.
virtual ~State()
Virtual destructor.
static const State & getInstance(ID state_id)
Returns a State instance of the given state.
const MasterToken & getToken(const MasterLexer &lexer) const
bool wasLastEOL(const MasterLexer &lexer) const
@ CRLF
Just seen a carriage-return character.
@ QString
Handling a quoted string token.
Defines the logger used by the top-level component of kea-lfc.