mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Moved token enums into Token scope
This commit is contained in:
54
src/token.h
54
src/token.h
@@ -11,29 +11,6 @@
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
enum TOKEN_STATUS { TS_VALID, TS_INVALID, TS_UNVERIFIED };
|
||||
enum TOKEN_TYPE {
|
||||
TT_DIRECTIVE,
|
||||
TT_DOC_START,
|
||||
TT_DOC_END,
|
||||
TT_BLOCK_SEQ_START,
|
||||
TT_BLOCK_MAP_START,
|
||||
TT_BLOCK_SEQ_END,
|
||||
TT_BLOCK_MAP_END,
|
||||
TT_BLOCK_ENTRY,
|
||||
TT_FLOW_SEQ_START,
|
||||
TT_FLOW_MAP_START,
|
||||
TT_FLOW_SEQ_END,
|
||||
TT_FLOW_MAP_END,
|
||||
TT_FLOW_ENTRY,
|
||||
TT_KEY,
|
||||
TT_VALUE,
|
||||
TT_ANCHOR,
|
||||
TT_ALIAS,
|
||||
TT_TAG,
|
||||
TT_SCALAR
|
||||
};
|
||||
|
||||
const std::string TokenNames[] = {
|
||||
"DIRECTIVE",
|
||||
"DOC_START",
|
||||
@@ -57,7 +34,32 @@ namespace YAML
|
||||
};
|
||||
|
||||
struct Token {
|
||||
Token(TOKEN_TYPE type_, const Mark& mark_): status(TS_VALID), type(type_), mark(mark_) {}
|
||||
// enums
|
||||
enum STATUS { VALID, INVALID, UNVERIFIED };
|
||||
enum TYPE {
|
||||
DIRECTIVE,
|
||||
DOC_START,
|
||||
DOC_END,
|
||||
BLOCK_SEQ_START,
|
||||
BLOCK_MAP_START,
|
||||
BLOCK_SEQ_END,
|
||||
BLOCK_MAP_END,
|
||||
BLOCK_ENTRY,
|
||||
FLOW_SEQ_START,
|
||||
FLOW_MAP_START,
|
||||
FLOW_SEQ_END,
|
||||
FLOW_MAP_END,
|
||||
FLOW_ENTRY,
|
||||
KEY,
|
||||
VALUE,
|
||||
ANCHOR,
|
||||
ALIAS,
|
||||
TAG,
|
||||
SCALAR
|
||||
};
|
||||
|
||||
// data
|
||||
Token(TYPE type_, const Mark& mark_): status(VALID), type(type_), mark(mark_) {}
|
||||
|
||||
friend std::ostream& operator << (std::ostream& out, const Token& token) {
|
||||
out << TokenNames[token.type] << std::string(": ") << token.value;
|
||||
@@ -66,8 +68,8 @@ namespace YAML
|
||||
return out;
|
||||
}
|
||||
|
||||
TOKEN_STATUS status;
|
||||
TOKEN_TYPE type;
|
||||
STATUS status;
|
||||
TYPE type;
|
||||
Mark mark;
|
||||
std::string value;
|
||||
std::vector <std::string> params;
|
||||
|
Reference in New Issue
Block a user