Add some extra const modifiers.
This commit is contained in:
parent
db7c4ddcd4
commit
1ec84a02b4
2 changed files with 15 additions and 14 deletions
|
@ -136,23 +136,24 @@ const token& tokenizer::next_token()
|
|||
return token_;
|
||||
}
|
||||
|
||||
const token& tokenizer::current_token()
|
||||
const token& tokenizer::current_token() const
|
||||
{
|
||||
return token_;
|
||||
}
|
||||
|
||||
|
||||
bool tokenizer::is_space(int c)
|
||||
bool tokenizer::is_space(const int c) const
|
||||
{
|
||||
return c == ' ' || c == '\t';
|
||||
}
|
||||
|
||||
bool tokenizer::is_alnum(int c)
|
||||
bool tokenizer::is_alnum(const int c) const
|
||||
{
|
||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
|
||||
return (c >= 'a' && c <= 'z')
|
||||
|| (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
|
||||
}
|
||||
|
||||
std::string tokenizer::get_line()
|
||||
std::string tokenizer::get_line() const
|
||||
{
|
||||
std::ostringstream s;
|
||||
s << tokenstart_lineno_ << ' ' << file_;
|
||||
|
@ -195,7 +196,7 @@ void tokenizer_stream::next_char()
|
|||
} while(current_ == '\r');
|
||||
}
|
||||
|
||||
int tokenizer_stream::peek_char()
|
||||
int tokenizer_stream::peek_char() const
|
||||
{
|
||||
return in_.peek();
|
||||
}
|
||||
|
@ -217,7 +218,7 @@ void tokenizer_string::next_char()
|
|||
|
||||
}
|
||||
|
||||
int tokenizer_string::peek_char()
|
||||
int tokenizer_string::peek_char() const
|
||||
{
|
||||
return in_[offset_];
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ public:
|
|||
virtual ~tokenizer() {}
|
||||
|
||||
const token& next_token();
|
||||
const token& current_token();
|
||||
std::string get_line();
|
||||
const token& current_token() const;
|
||||
std::string get_line() const;
|
||||
std::string& textdomain();
|
||||
|
||||
protected:
|
||||
|
@ -63,10 +63,10 @@ protected:
|
|||
size_t lineno_;
|
||||
|
||||
virtual void next_char() = 0;
|
||||
virtual int peek_char() = 0;
|
||||
virtual int peek_char() const = 0;
|
||||
private:
|
||||
bool is_space(int c);
|
||||
bool is_alnum(int c);
|
||||
bool is_space(const int c) const;
|
||||
bool is_alnum(const int c) const;
|
||||
void skip_comment();
|
||||
|
||||
std::string textdomain_;
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
protected:
|
||||
void next_char();
|
||||
int peek_char();
|
||||
int peek_char() const;
|
||||
|
||||
private:
|
||||
std::istream& in_;
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
protected:
|
||||
void next_char();
|
||||
int peek_char();
|
||||
int peek_char() const;
|
||||
|
||||
private:
|
||||
std::string& in_;
|
||||
|
|
Loading…
Add table
Reference in a new issue