ModErn Text Analysis
META Enumerates Textual Applications
transition_finder.h
Go to the documentation of this file.
1 
9 #ifndef META_PARSER_TRANSITION_FINDER_H_
10 #define META_PARSER_TRANSITION_FINDER_H_
11 
12 #include <vector>
13 
14 #include "parser/transition.h"
15 #include "parser/trees/visitors/visitor.h"
16 
17 namespace meta
18 {
19 namespace parser
20 {
21 
30 class transition_finder : public const_visitor<void>
31 {
32  public:
33  void operator()(const leaf_node&) override;
34  void operator()(const internal_node&) override;
35 
42  std::vector<transition> transitions();
43 
44  class exception : public std::runtime_error
45  {
46  public:
47  using std::runtime_error::runtime_error;
48  };
49 
50  private:
54  std::vector<transition> transitions_;
55 };
56 }
57 }
58 
59 #endif
An internal node in a parse tree.
Definition: internal_node.h:28
This is a visitor that converts a parse tree into a list of transitions that a shift-reduce parser wo...
Definition: transition_finder.h:30
std::vector< transition > transitions()
Extracts the transitions out of the visitor.
Definition: transition_finder.cpp:50
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retreival, data mining, and other applications of text processing.
Definition: analyzer.h:24
void operator()(const leaf_node &) override
Definition: transition_finder.cpp:15
std::vector< transition > transitions_
Storage for the transitions.
Definition: transition_finder.h:54
Abstract base class for visitors over parse trees that do not modify the underlying tree...
Definition: visitor.h:25
A leaf node (pre-terminal) in a parse tree.
Definition: leaf_node.h:24
Definition: transition_finder.h:44