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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: Parse error while parsing line: [ #16

Closed
Mathieu-Lala opened this issue Dec 1, 2022 · 5 comments
Closed

error: Parse error while parsing line: [ #16

Mathieu-Lala opened this issue Dec 1, 2022 · 5 comments

Comments

@Mathieu-Lala
Copy link

Hi 馃憢

I tried to add document-features to my project https://github.com/viridIT/vSMTP/compare/develop...doc/feature but I have this error :
I believe this is a bug in the parser 馃悰

error: Parse error while parsing line: [
  --> src/vsmtp/vsmtp-core/src/lib.rs:21:10
   |
21 | #![doc = document_features::document_features!()]
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `document_features::document_features` (in Nightly builds, run with -Z macro-backtrace for more info)

error: Compilation failed, aborting rustdoc

error: could not document `vsmtp`

Caused by:
  process didn't exit successfully: `rustdoc [...]
@ogoffart
Copy link
Member

ogoffart commented Dec 1, 2022

The toml parser used in the crate is a bit basic and it looks like your Cargo.toml is quite complicated with its meta-data split in many lines.

I have a suspicion that the problem happens trying to parse array in array

@Mathieu-Lala
Copy link
Author

Do you think this could fix it ?

https://github.com/slint-ui/document-features/blob/master/lib.rs#L308

current_table = match table.split_once("]").map(|(t, _)| t.trim()) {
  Some(line) => line,
  None => continue, // ignore the sequence "\n[(.*)\n"
}

@ogoffart
Copy link
Member

ogoffart commented Dec 1, 2022

I think we should try to skip all the lines until the end of the array by using get_balanced.

In fact, we should try to call get_balanced even when in other sections, contrary to what this comment say

// Don't call `get_balanced` if we are not in features or a dependency table

@Mathieu-Lala
Copy link
Author

Thanks for the fix! It worked fine with my crate. Will you publish to crates.io the new version ?

@ogoffart
Copy link
Member

Your wishes have come true :-) 0.2.7 was published

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

No branches or pull requests

2 participants