Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Nov 17, 2024
1 parent 20dc95c commit d9c3bd0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
9 changes: 5 additions & 4 deletions src/mikroxml/mikroxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ void parser::process_parsed_tag_name()
this->cur_state = state::declaration;
return;
case '!':
// TRACE(<< "this->buf = " << std::string(&*this->buf.begin(), this->buf.size()) << std::endl)
if (starts_with(this->buf, doctype_tag_word)) {
this->cur_state = state::doctype;
} else {
Expand Down Expand Up @@ -574,8 +573,9 @@ void parser::parse_tag(utki::span<const char>::iterator& i, utki::span<const cha
if (!this->buf.empty()) {
this->process_parsed_tag_name();

// After parsing usual tag we expect attributes, but since we got '/' the tag has no any attributes,
// so it is empty. In other cases, like '!DOCTYPE' tag the cur_state should remain.
// After parsing usual tag we expect attributes, but since we got '/'
// the tag has no any attributes, so it is empty. In other cases, like
// '!DOCTYPE' tag the cur_state should remain.
if (this->cur_state == state::attributes) {
this->cur_state = state::tag_empty;
}
Expand Down Expand Up @@ -726,7 +726,8 @@ void parser::parse_doctype_entity_seek_to_value(
default:
throw malformed_xml(
this->line_number,
"unexpected character encountered while seeking to DOCTYPE entity value, expected '\"'."
"unexpected character encountered while seeking to "
"DOCTYPE entity value, expected '\"'."
);
}
}
Expand Down
16 changes: 11 additions & 5 deletions src/mikroxml/mikroxml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ class parser
void process_parsed_ref_char();

std::vector<char> buf;
std::vector<char> name; // general variable for storing name of something (attribute name, entity name, etc.)

// general variable for storing name of something
// (attribute name, entity name, etc.)
std::vector<char> name;

std::vector<char> ref_char_buf;

char attr_value_quote_char = 0;
Expand Down Expand Up @@ -133,21 +137,23 @@ class parser

/**
* @brief Element end.
* @param name - name of the element which has ended. Name is empty if empty element has ended.
* @param name - name of the element which has ended. Name is empty if empty
* element has ended.
*/
virtual void on_element_end(utki::span<const char> name) = 0;

/**
* @brief Attributes section end notification.
* This callback is called when all attributes of the last element have been parsed.
* This callback is called when all attributes of the last element have been
* parsed.
* @param is_empty_element - indicates weather the element is empty element or not.
*/
virtual void on_attributes_end(bool is_empty_element) = 0;

/**
* @brief Attribute parsed notification.
* This callback may be called after 'on_element_start' notification. It can be called several times, once for each
* parsed attribute.
* This callback may be called after 'on_element_start' notification. It can
* be called several times, once for each parsed attribute.
* @param name - name of the parsed attribute.
* @param value - value of the parsed attribute.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/samples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const tst::set set("samples", [](tst::suite& suite){

auto cmp_data = papki::fs_file(in_file_name + ".cmp").load();

if(out_data != cmp_data){
if(utki::deep_not_equals(out_data, utki::make_span(cmp_data))){
papki::fs_file failed_file(p + ".out");

{
Expand Down
2 changes: 1 addition & 1 deletion tool-configs

0 comments on commit d9c3bd0

Please sign in to comment.