virtual void OnToken(int line_nr, const char *name, TBValue &value) { if (!m_target_node) return; if (strcmp(name, "@file") == 0) IncludeFile(line_nr, value.GetString()); else if (strcmp(name, "@include") == 0) IncludeRef(line_nr, value.GetString()); else if (TBNode *n = TBNode::Create(name)) { n->m_value.TakeOver(value); m_target_node->Add(n); } }
void TBParser::ConsumeValue(TBValue &dst_value, char *&line) { // Find value (As quoted string, or as auto) char *value = line; if (*line == '\"' || *line == '\'') { const char quote_type = *line; // Consume starting quote line++; value++; // Find ending quote or end while (!IsEndQuote(value, line, quote_type) && *line != 0) line++; // Terminate away the quote if (*line == quote_type) *line++ = 0; // consume any whitespace while (is_white_space(line)) line++; // consume any comma if (*line == ',') line++; UnescapeString(value); dst_value.SetString(value, TBValue::SET_AS_STATIC); } else { // Find next comma or end while (*line != ',' && *line != 0) line++; // Terminate away the comma if (*line == ',') *line++ = 0; UnescapeString(value); dst_value.SetFromStringAuto(value, TBValue::SET_AS_STATIC); } // Check if we still have pending value data on the following line and set pending_multiline. bool continuing_multiline = pending_multiline; pending_multiline = is_pending_multiline(line); // Append the multi line value to the buffer. if (continuing_multiline || pending_multiline) multi_line_value.AppendString(dst_value.GetString()); }