Fixed crash problem with ast.

This commit is contained in:
yhirose 2015-07-29 21:47:58 -04:00
parent 0e70fc94f8
commit 5a09846a15

View File

@ -1958,14 +1958,14 @@ inline constexpr unsigned int operator "" _(const char* s, size_t) {
struct Ast struct Ast
{ {
Ast(const char* path, size_t line, size_t column, const char* name, const std::vector<std::shared_ptr<Ast>>& nodes) Ast(const char* path, size_t line, size_t column, const char* name, const std::vector<std::shared_ptr<Ast>>& nodes)
: path(path), line(line), column(column), name(name), original_name(name), is_token(false), nodes(nodes) : path(path ? path : ""), line(line), column(column), name(name), original_name(name), is_token(false), nodes(nodes)
#ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT #ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT
, tag(str2tag(name)), original_tag(tag) , tag(str2tag(name)), original_tag(tag)
#endif #endif
{} {}
Ast(const char* path, size_t line, size_t column, const char* name, const std::string& token) Ast(const char* path, size_t line, size_t column, const char* name, const std::string& token)
: path(path), line(line), column(column), name(name), original_name(name), is_token(true), token(token) : path(path ? path : ""), line(line), column(column), name(name), original_name(name), is_token(true), token(token)
#ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT #ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT
, tag(str2tag(name)), original_tag(tag) , tag(str2tag(name)), original_tag(tag)
#endif #endif