Skip to content
This repository was archived by the owner on Nov 11, 2025. It is now read-only.

Refactor parsing in kicad_rs#11

Merged
luxas merged 3 commits into
mainfrom
kicad-evaluator
Jun 16, 2021
Merged

Refactor parsing in kicad_rs#11
luxas merged 3 commits into
mainfrom
kicad-evaluator

Conversation

@twelho
Copy link
Copy Markdown
Member

@twelho twelho commented Jun 16, 2021

Continuation of #8 now that the common types and routines have been integrated from the parser side. Makes some necessary changes to help facilitate code sharing for the evaluator.

WIP, cc @luxas @chiplet

@twelho twelho added the enhancement New feature or request label Jun 16, 2021
@twelho twelho self-assigned this Jun 16, 2021
@twelho twelho force-pushed the kicad-evaluator branch from 2aae9ba to 30dbe33 Compare June 16, 2021 12:22
Copy link
Copy Markdown
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

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

Thanks for the refactor in the first two commits. Can we merge now and I'll rebase my work on top of this as well?


use crate::types::*;

type ParseResult<T> = Result<T, Box<dyn Error>>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we make an utils file, this would make a pretty good DynamicError type

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Or DynamicResult, for now it can live here, but we should definitely do that move if it's also used elsewhere.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

DynamicResult Oh, yeah that was what I meant 😂

@twelho twelho changed the title Implement the KiCad evaluator Refactor parsing in kicad-rs Jun 16, 2021
@twelho twelho changed the title Refactor parsing in kicad-rs Refactor parsing in kicad_rs Jun 16, 2021
let kisch = kicad_parse_gen::read_schematic(path)?;

// Parse the fields for the schematic
let meta = parse_meta(&kisch, path)?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

None if these 4 seem to actually require the "whole" of a kicad_parse_gen::Schematic. Maybe you can scope this down to just the description, components vector, etc.?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since it's passed as an immutable reference, I don't see the need to restrict the input scope unnecessarily if we decide to add/change the functionality of those functions later to also look at other fields (for example having parse_meta count the components, which is not possible with just with kisch.description).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, I have no strong preference. It's good as-is

@twelho
Copy link
Copy Markdown
Member Author

twelho commented Jun 16, 2021

Thanks for the refactor in the first two commits. Can we merge now and I'll rebase my work on top of this as well?

I've changed the PR message and title now, so you can go ahead and merge if it looks good to you.

@twelho twelho marked this pull request as ready for review June 16, 2021 14:12
@luxas luxas merged commit b4a7362 into main Jun 16, 2021
@twelho twelho deleted the kicad-evaluator branch June 16, 2021 14:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants