MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / deserialize_node_properties

Function deserialize_node_properties

example/cacheHierarchy/fkYAML/node.hpp:8089–8151  ·  view source on GitHub ↗

@brief Deserializes YAML node properties (anchor and/or tag names) if they exist @param lexer The lexical analyzer to be used. @param last_type The variable to store the last lexical token type. @param line The variable to store the line of either the first property or the last non-property token. @param indent The variable to store the indent of either the first property or the last non-property

Source from the content-addressed store, hash-verified

8087 /// @param indent The variable to store the indent of either the first property or the last non-property token.
8088 /// @return true if any property is found, false otherwise.
8089 bool deserialize_node_properties(lexer_type& lexer, lexical_token& last_token, uint32_t& line, uint32_t& indent) {
8090 m_needs_anchor_impl = m_needs_tag_impl = false;
8091
8092 lexical_token token = last_token;
8093 bool ends_loop {false};
8094 do {
8095 if (line < lexer.get_lines_processed()) {
8096 break;
8097 }
8098
8099 switch (token.type) {
8100 case lexical_token_t::ANCHOR_PREFIX:
8101 if FK_YAML_UNLIKELY (m_needs_anchor_impl) {
8102 throw parse_error(
8103 "anchor name cannot be specified more than once to the same node.",
8104 lexer.get_lines_processed(),
8105 lexer.get_last_token_begin_pos());
8106 }
8107
8108 m_anchor_name = token.str;
8109 m_needs_anchor_impl = true;
8110
8111 if (!m_needs_tag_impl) {
8112 line = lexer.get_lines_processed();
8113 indent = lexer.get_last_token_begin_pos();
8114 }
8115
8116 token = lexer.get_next_token();
8117 break;
8118 case lexical_token_t::TAG_PREFIX: {
8119 if FK_YAML_UNLIKELY (m_needs_tag_impl) {
8120 throw parse_error(
8121 "tag name cannot be specified more than once to the same node.",
8122 lexer.get_lines_processed(),
8123 lexer.get_last_token_begin_pos());
8124 }
8125
8126 m_tag_name = token.str;
8127 m_needs_tag_impl = true;
8128
8129 if (!m_needs_anchor_impl) {
8130 line = lexer.get_lines_processed();
8131 indent = lexer.get_last_token_begin_pos();
8132 }
8133
8134 token = lexer.get_next_token();
8135 break;
8136 }
8137 default:
8138 ends_loop = true;
8139 break;
8140 }
8141 } while (!ends_loop);
8142
8143 last_token = token;
8144 const bool prop_specified = m_needs_anchor_impl || m_needs_tag_impl;
8145 if (!prop_specified) {
8146 line = lexer.get_lines_processed();

Callers 2

node.hppFile · 0.85
deserialize_nodeFunction · 0.85

Calls 4

parse_errorClass · 0.85
get_lines_processedMethod · 0.80
get_next_tokenMethod · 0.80

Tested by

no test coverage detected