Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

upgrade to nom 2.0 #83

Merged
merged 1 commit into from
Nov 25, 2016
Merged

upgrade to nom 2.0 #83

merged 1 commit into from
Nov 25, 2016

Conversation

Geal
Copy link
Contributor

@Geal Geal commented Nov 25, 2016

Hi!

as a part of the release process for nom 2.0, I selected a few crates to test it with, and make sure everything works correctly.

I changed a few things, and this project should work fine with nom 2.0 now!

If you want more information on this release, see the blogpost: https://unhandledexpression.com/2016/11/25/this-year-in-nom-2-0-is-here/ (reddit discussion: https://www.reddit.com/r/rust/comments/5espfm/this_year_in_nom_20_is_here/ )

There are new features that could be of interest for this project :)

@Hywan
Copy link
Member

Hywan commented Nov 25, 2016

Thank you very much!

I did start a similar PR yesterday night, haha 😉, but I am glad to accept yours!

@Geal
Copy link
Contributor Author

Geal commented Nov 25, 2016

This is an amazing project, I really wanted it to work on 2.0 :)

@Hywan
Copy link
Member

Hywan commented Nov 25, 2016

Same here 😉. What is the concrete difference between chain! and do_parse!? I am using them intensively.

@Hywan
Copy link
Member

Hywan commented Nov 25, 2016

@Geal The new tag_no_case! is equivalent to itag! (defined in this project). Is the former faster and more performant? If you are planning to add UTF-8 support, will it be with the same macro? I really don't need UTF-8 support, and I am afraid it could slow things down.

@Hywan
Copy link
Member

Hywan commented Nov 25, 2016

Hurray for named_attr! by the way. I did try to implement this one but it was really hard. Thanks!

@Hywan Hywan merged commit cea3b64 into tagua-vm:master Nov 25, 2016
@Geal
Copy link
Contributor Author

Geal commented Nov 25, 2016

tag_no_case! works on ascii strings by ignoring the bit that indicates case, while itag! has eq_ignore_ascii_case that uses a lookup table. I have not benchmarked the two, I'd be interested in the results.

If you pass a &str to tag_no_case!, it will lowercase both strings and compare, which is a really bad way to do it (people really shouldn't do case insensitive comparison on strings containing unicode chars).

Both implementations are separated in trait implementations: https://github.com/Geal/nom/blob/master/src/traits.rs#L288-L387

If you're worried about performance, benchmark tag_no_case and itag, keep the fastest, and keep casting to a &[u8] before comparing, that should work.

For named_attr!, I'm not the one who wrote it, but I'm really happy to see it too :)

@Geal
Copy link
Contributor Author

Geal commented Nov 25, 2016

For the difference between chain! and do_parse!: chain! is hard to maintain because of its weird syntax and unnecessary features. do_parse! is a simpler rewrite of this combinator. There's no more "?" (replaced with opt!) nor "mut" (people didn't really use it, apparently).

In this release, I also wanted people to break free from their chains (lol), because they use it everywhere, while there are a lot of nice helpers like pair! or terminated!

@Hywan
Copy link
Member

Hywan commented Nov 25, 2016

people to break free from their chains

huhu 😉.

OK, thanks! I would be glad to compare

@Hywan Hywan mentioned this pull request Nov 25, 2016
3 tasks
@Hywan
Copy link
Member

Hywan commented Nov 25, 2016

@Geal Ahhh, named_attr! ❤️, #87.

@Geal
Copy link
Contributor Author

Geal commented Nov 25, 2016

wow you're fast 😮

@Hywan
Copy link
Member

Hywan commented Nov 25, 2016

Awesomeness does not wait. Tagua VM is a high quality project, don't want to postpone things like that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants