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

Bugs fixes And Improvements of MBE #1209

Merged
merged 5 commits into from
Apr 25, 2019

Conversation

edwin0cheng
Copy link
Member

This PR fixed / improve followings things:

  • Add token $repeat separator support: Previously $repeat only support single punct separator.
  • Fixed a bug which expand infinite pattern, see test_match_group_in_group
  • Correctly handle +,*,? case of $repeat patterns
  • Increase the limit of $repeat patterns (128 => 65536), personally i think we could remove this limit as we seem to fix all major loop bugs
  • Re-enable tt matcher
  • Better meta item parsing.
  • Add related tests and add some real world test cases.
  • Add more debug information.

@edwin0cheng edwin0cheng changed the title Bugs fixes And Improvement of MBE Bugs fixes And Improvements of MBE Apr 25, 2019
crates/ra_mbe/src/subtree_source.rs Outdated Show resolved Hide resolved
break;
}
_ => break,
}
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a test for it?

Also, this was recently changed in rust-lang/rust#57367, I am not sure if the refercne is up-to-date

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know where to add the test, as this function only called from mbe right now.
I can add that test in mbe if you want.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, right, the parser doesn't need this itself. I guess I am fine with existing tests in mbe then!

@matklad
Copy link
Member

matklad commented Apr 25, 2019

bors r+

bors bot added a commit that referenced this pull request Apr 25, 2019
1209: Bugs fixes And Improvements of MBE r=matklad a=edwin0cheng

This PR fixed / improve followings things:

* Add `token` `$repeat` separator support: Previously $repeat only support single punct separator. 
* Fixed a bug which expand infinite pattern, see `test_match_group_in_group` 
* Correctly handle +,*,? case of $repeat patterns
* Increase the limit of $repeat patterns (128 => 65536), personally i think we could remove this limit as we seem to fix all major loop bugs
* **Re-enable tt matcher**
* Better meta item parsing.
* Add related tests and add some real world test cases.
* Add more debug information.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
@edwin0cheng
Copy link
Member Author

edwin0cheng commented Apr 25, 2019

Finally i feel confident to refactor the lexer and mbe with enough test cases :)

@matklad
Copy link
Member

matklad commented Apr 25, 2019

@edwin0cheng yeah, I also feel that that's just the right approach: build the basic test-suite using simplistic solution, then refactor to the proper infra, and then the remaining 90% of fixing all of the bugs :D

@bors
Copy link
Contributor

bors bot commented Apr 25, 2019

Build succeeded

@bors bors bot merged commit 1908819 into rust-lang:master Apr 25, 2019
@edwin0cheng edwin0cheng deleted the fix_gen_pat_iter_bug branch April 25, 2019 19:19
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