Skip to content

Commit

Permalink
tokenizer debug code is disabled by default
Browse files Browse the repository at this point in the history
Change #ifdef DEBUG to #ifdef DEBUG_TOKENIZER, to assist with
profiling using callgrind.
  • Loading branch information
cbeck88 committed Jun 13, 2014
1 parent d2fe8d1 commit d7c2675
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/serialization/parser.cpp
Expand Up @@ -382,7 +382,7 @@ void parser::error(const std::string& error_type, const std::string& pos_format)
std::stringstream ss;
ss << tok_.get_start_line() << " " << tok_.get_file();

#ifdef DEBUG
#ifdef DEBUG_TOKENIZER
i18n_symbols["value"] = tok_.current_token().value;
i18n_symbols["previous_value"] = tok_.previous_token().value;

Expand Down
2 changes: 1 addition & 1 deletion src/serialization/tokenizer.cpp
Expand Up @@ -54,7 +54,7 @@ tokenizer::~tokenizer()

const token &tokenizer::next_token()
{
#if DEBUG
#if DEBUG_TOKENIZER
previous_token_ = token_;
#endif
token_.value.clear();
Expand Down
6 changes: 4 additions & 2 deletions src/serialization/tokenizer.hpp
Expand Up @@ -16,6 +16,8 @@
#ifndef TOKENIZER_H_INCLUDED
#define TOKENIZER_H_INCLUDED

//#define DEBUG_TOKENIZER

#include "buffered_istream.hpp"

#include <istream>
Expand Down Expand Up @@ -66,7 +68,7 @@ class tokenizer
return token_;
}

#ifdef DEBUG
#ifdef DEBUG_TOKENIZER
const token &previous_token() const
{
return previous_token_;
Expand Down Expand Up @@ -169,7 +171,7 @@ class tokenizer
std::string textdomain_;
std::string file_;
token token_;
#ifdef DEBUG
#ifdef DEBUG_TOKENIZER
token previous_token_;
#endif
buffered_istream in_;
Expand Down

0 comments on commit d7c2675

Please sign in to comment.