Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an ability to parse the xml_converter duplicate category output #406

Merged
merged 5 commits into from
Feb 17, 2025

Conversation

AsherGlick
Copy link
Owner

This adds the ability to parse the xml_converter output to detect when it reports that a duplicate category has been detected.

#
# A helper function to see if a string starts with a paticular value or not.
################################################################################
static func starts_with(value: String, prefix: String):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a String function called begins_with that I think does what this function does. https://docs.godotengine.org/en/3.3/classes/class_string.html#class-string-method-begins-with

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, I got tunnel vision searching for starts_with.

var file_name = line.substr(8)
colisions[category].append(file_name)
elif starts_with(line, " "):
var line_without_prefix = line.substr(5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you leave a comment that this is removing 4 spaces and the leading quotation mark? It wasn't clear on my first read-through.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

static func get_duplicate_categories(stdin: String):
var lines: PoolStringArray = stdin.split("\n")
var capturing: bool = false
var colisions = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collisions is spelled incorrectly

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

################################################################################
# get_duplicate_categories
#
# Parses the stdout of the xml_converter and extracts any category colisions if
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collisions is spelled incorrectly

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

#
# Parses the stdout of the xml_converter and extracts any category colisions if
# there are any that exist.
################################################################################
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth adding an example here of what we expect to parse so that if it ever breaks, we have something to compare against. Especially since we do not have integration tests for this code.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@AsherGlick AsherGlick merged commit e14eb99 into xml_converter Feb 17, 2025
12 checks passed
@AsherGlick AsherGlick deleted the converter_output_parsing branch February 17, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants