Add an example usecase of the parser.#1177
Merged
windelbouwman merged 2 commits intomasterfrom Jul 26, 2019
Merged
Conversation
silmeth
reviewed
Jul 25, 2019
examples/parse_folder.rs
Outdated
|
|
||
| fn main() { | ||
| env_logger::init(); | ||
| let app = App::new("RustPython") |
Contributor
There was a problem hiding this comment.
Since RustPython is the name of the whole project and, presumably, its interpreter as a stand-alone application – shouldn’t this be called something else (or at least – more specific)?
Contributor
Author
There was a problem hiding this comment.
Oops, copy paste error, thanks!
coolreader18
approved these changes
Jul 25, 2019
examples/parse_folder.rs
Outdated
| res.extend(x); | ||
| } | ||
|
|
||
| if metadata.is_file() && path.extension().map(|s| s.to_str().unwrap()) == Some("py") { |
Member
There was a problem hiding this comment.
Suggested change
| if metadata.is_file() && path.extension().map(|s| s.to_str().unwrap()) == Some("py") { | |
| if metadata.is_file() && path.extension().and_then(|s| s.to_str()) == Some("py") { |
| if folder.exists() && folder.is_dir() { | ||
| println!("Parsing folder of python code: {:?}", folder); | ||
| let res = parse_folder(&folder).unwrap(); | ||
| println!("Processed {:?} files", res.len()); |
Member
There was a problem hiding this comment.
Should it print the parsed files or something?
Contributor
Author
There was a problem hiding this comment.
I have some ideas for metrics:
- parsed lines per second
- print the amount of functions / classes
For now, I just use it to try and scan my cpython lib folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.