Kea  1.9.9-git
master_lexer_state.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2020 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 1
9 
10 #include <dns/master_lexer.h>
11 
12 namespace isc {
13 namespace dns {
14 
15 namespace master_lexer_internal {
16 
48 class State {
49 public:
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 {
92  CRLF,
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 
116 protected:
126  MasterLexer::MasterLexerImpl* getLexerImpl(MasterLexer& lexer) const {
127  return (lexer.impl_);
128  }
129 };
130 
131 } // namespace master_lexer_internal
132 } // namespace dns
133 } // namespace isc
134 #endif // MASTER_LEXER_STATE_H
135 
136 // Local Variables:
137 // mode: c++
138 // End:
Just seen a carriage-return character.
virtual void handle(MasterLexer &lexer) const =0
Handle the process of one specific state.
bool wasLastEOL(const MasterLexer &lexer) const
size_t getParenCount(const MasterLexer &lexer) const
static const State * start(MasterLexer &lexer, MasterLexer::Options options)
Begin state transitions to get the next token.
Defines the logger used by the top-level component of kea-dhcp-ddns.
const MasterToken & getToken(const MasterLexer &lexer) const
virtual ~State()
Virtual destructor.
Options
Options for getNextToken.
Definition: master_lexer.h:343
Tokens for MasterLexer.
Definition: master_lexer.h:39
Tokenization state for MasterLexer.
static const State & getInstance(ID state_id)
Returns a State instance of the given state.
Tokenizer for parsing DNS master files.
Definition: master_lexer.h:301
MasterLexer::MasterLexerImpl * getLexerImpl(MasterLexer &lexer) const
An accessor to the internal implementation class of MasterLexer.