19 #ifndef PYTHON_CONTEXT_PARSER_HH
20 #define PYTHON_CONTEXT_PARSER_HH
31 namespace ost {
namespace gui {
45 return parent_ == NULL;
51 const std::vector<PythonContext*>& GetSubContexts()
const
52 {
return sub_contexts_; }
54 void SetRange(
const Range& range)
62 range_.length = token.
GetRange().
End()-range_.location;
63 token_list_.push_back(token);
68 for (
size_t i = 0; i < token_list_.size(); ++i) {
69 std::cout << token_list_[i].GetValue().toStdString() << std::endl;
83 sub_contexts_.push_back(context);
84 sub_contexts_.back()->parent_ =
this;
87 bool GetContextAtLocation(
size_t location,
PythonContext*& context);
93 std::vector<PythonContext*> sub_contexts_;
95 std::vector<PythonToken> token_list_;
110 this->PrintRecursively(root_,0);
113 void Parse(
const QString& command);
115 const QString& GetCommand()
const
118 bool GetContextAtLocation(
size_t location,
121 return root_->GetContextAtLocation(location,context);
130 void PrintRecursively(
const PythonContext* context,
int level)
132 typedef std::vector<PythonContext*>::const_iterator const_it;
134 for (
int j = 0; j < level; ++j)
145 this->PrintRecursively(*i,level+1);
149 PythonTokenizer tokenizer_;
150 PythonContext* root_;