token.h
Go to the documentation of this file.
1 #ifndef TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
2 #define TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
3 
4 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5 #pragma once
6 #endif
7 
8 
9 #include "yaml-cpp-pm/mark.h"
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 
14 namespace YAML_PM
15 {
16  const std::string TokenNames[] = {
17  "DIRECTIVE",
18  "DOC_START",
19  "DOC_END",
20  "BLOCK_SEQ_START",
21  "BLOCK_MAP_START",
22  "BLOCK_SEQ_END",
23  "BLOCK_MAP_END",
24  "BLOCK_ENTRY",
25  "FLOW_SEQ_START",
26  "FLOW_MAP_START",
27  "FLOW_SEQ_END",
28  "FLOW_MAP_END",
29  "FLOW_MAP_COMPACT",
30  "FLOW_ENTRY",
31  "KEY",
32  "VALUE",
33  "ANCHOR",
34  "ALIAS",
35  "TAG",
36  "SCALAR"
37  };
38 
39  struct Token {
40  // enums
42  enum TYPE {
57  KEY,
61  TAG,
64  };
65 
66  // data
67  Token(TYPE type_, const Mark& mark_): status(VALID), type(type_), mark(mark_), data(0) {}
68 
69  friend std::ostream& operator << (std::ostream& out, const Token& token) {
70  out << TokenNames[token.type] << std::string(": ") << token.value;
71  for(std::size_t i=0;i<token.params.size();i++)
72  out << std::string(" ") << token.params[i];
73  return out;
74  }
75 
80  std::vector <std::string> params;
81  int data;
82  };
83 }
84 
85 #endif // TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
YAML_PM::Token::BLOCK_MAP_START
@ BLOCK_MAP_START
Definition: token.h:47
YAML_PM::Token::FLOW_MAP_START
@ FLOW_MAP_START
Definition: token.h:52
YAML_PM::Token::KEY
@ KEY
Definition: token.h:57
YAML_PM::Token::PLAIN_SCALAR
@ PLAIN_SCALAR
Definition: token.h:62
YAML_PM::Token::operator<<
friend std::ostream & operator<<(std::ostream &out, const Token &token)
Definition: token.h:69
YAML_PM::TokenNames
const std::string TokenNames[]
Definition: token.h:16
YAML_PM::Token::status
STATUS status
Definition: token.h:76
YAML_PM::Token::BLOCK_SEQ_END
@ BLOCK_SEQ_END
Definition: token.h:48
YAML_PM
Definition: aliasmanager.h:11
YAML_PM::Token::STATUS
STATUS
Definition: token.h:41
YAML_PM::Token::mark
Mark mark
Definition: token.h:78
YAML_PM::Token::NON_PLAIN_SCALAR
@ NON_PLAIN_SCALAR
Definition: token.h:63
YAML_PM::Token::UNVERIFIED
@ UNVERIFIED
Definition: token.h:41
YAML_PM::Token::FLOW_SEQ_END
@ FLOW_SEQ_END
Definition: token.h:53
YAML_PM::Token::BLOCK_SEQ_START
@ BLOCK_SEQ_START
Definition: token.h:46
YAML_PM::Token::TYPE
TYPE
Definition: token.h:42
YAML_PM::Token::params
std::vector< std::string > params
Definition: token.h:80
YAML_PM::Token::value
std::string value
Definition: token.h:79
testing::internal::string
::std::string string
Definition: gtest.h:1979
YAML_PM::Token::BLOCK_ENTRY
@ BLOCK_ENTRY
Definition: token.h:50
YAML_PM::Token::INVALID
@ INVALID
Definition: token.h:41
YAML_PM::Token::TAG
@ TAG
Definition: token.h:61
YAML_PM::Token::FLOW_ENTRY
@ FLOW_ENTRY
Definition: token.h:56
kitti-batch-convert.out
string out
Definition: kitti-batch-convert.py:7
YAML_PM::Token::VALID
@ VALID
Definition: token.h:41
YAML_PM::Token::BLOCK_MAP_END
@ BLOCK_MAP_END
Definition: token.h:49
YAML_PM::Token::DOC_START
@ DOC_START
Definition: token.h:44
YAML_PM::Token::DIRECTIVE
@ DIRECTIVE
Definition: token.h:43
YAML_PM::Token::type
TYPE type
Definition: token.h:77
YAML_PM::Token::DOC_END
@ DOC_END
Definition: token.h:45
YAML_PM::Token::ANCHOR
@ ANCHOR
Definition: token.h:59
YAML_PM::Mark
Definition: mark.h:13
YAML_PM::Token::FLOW_MAP_END
@ FLOW_MAP_END
Definition: token.h:54
YAML_PM::Token::VALUE
@ VALUE
Definition: token.h:58
YAML_PM::Token
Definition: token.h:39
YAML_PM::Token::FLOW_SEQ_START
@ FLOW_SEQ_START
Definition: token.h:51
YAML_PM::Token::FLOW_MAP_COMPACT
@ FLOW_MAP_COMPACT
Definition: token.h:55
YAML_PM::Token::data
int data
Definition: token.h:81
mark.h
YAML_PM::Token::Token
Token(TYPE type_, const Mark &mark_)
Definition: token.h:67
YAML_PM::Token::ALIAS
@ ALIAS
Definition: token.h:60


mp2p_icp
Author(s):
autogenerated on Wed Oct 23 2024 02:45:41