Added str() in SemanticValue.

This commit is contained in:
yhirose 2015-06-16 13:15:27 -04:00
parent d943c4fade
commit 6795c56c47
2 changed files with 8 additions and 0 deletions

View File

@ -92,6 +92,9 @@ struct SemanticValue {
// Cast semantic value // Cast semantic value
template <typename T> T& get(); template <typename T> T& get();
template <typename T> const T& get() const; template <typename T> const T& get() const;
// Get token
std::string str() const;
}; };
struct SemanticValues : protected std::vector<SemanticValue> struct SemanticValues : protected std::vector<SemanticValue>

View File

@ -171,6 +171,11 @@ struct SemanticValue
const T& get() const { const T& get() const {
return val.get<T>(); return val.get<T>();
} }
std::string str() const {
return std::string(s, n);
}
}; };
struct SemanticValues : protected std::vector<SemanticValue> struct SemanticValues : protected std::vector<SemanticValue>