mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Added str() in SemanticValue.
This commit is contained in:
parent
d943c4fade
commit
6795c56c47
@ -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>
|
||||||
|
5
peglib.h
5
peglib.h
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user