1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2  * Use of this file is governed by the BSD 3-clause license that
3  * can be found in the LICENSE.txt file in the project root.
4  */
5 
6 #pragma once
7 
8 #include "Vocabulary.h"
9 
10 namespace antlr4 {
11 namespace dfa {
12 
13   /// A DFA walker that knows how to dump them to serialized strings.
14   class ANTLR4CPP_PUBLIC DFASerializer {
15   public:
16     DFASerializer(const DFA *dfa, const std::vector<std::string>& tnames);
17     DFASerializer(const DFA *dfa, const Vocabulary &vocabulary);
18     virtual ~DFASerializer();
19 
20     virtual std::string toString() const;
21 
22   protected:
23     virtual std::string getEdgeLabel(size_t i) const;
24     virtual std::string getStateString(DFAState *s) const;
25 
26   private:
27     const DFA *_dfa;
28     const Vocabulary &_vocabulary;
29   };
30 
31 } // namespace atn
32 } // namespace antlr4
33