-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Parsing of percent array source - see #1005 #1010
Comments
At first glance this seems related to #894. |
I'm definitely not a parser expert. This issue seems related to the parser not having a good/complete set of rules for how white space (and what type of white space) affects various statements that can span multiple lines.
Re my previously mentioned pr, I decided to address the issue in the handlers, and I saw this issue affecting constants and cvars, in that both have a 'value' that is a portion of a NamespaceObject's source. For percent arrays, turns out that the source ends with white space if it is incorrectly parsed. I just incremented the range until I hit a non white space character. |
Update, just checked |
Well, I went back to the parser and fixed the issue there, rather than in the handlers. I just posted a file at -- https://github.com/MSP-Greg/MSP-Greg.github.io/blob/master/test/bench_ripper_lit.rb It shows the update to the parser, runs it and the current parser thru benchmark (similar to your freeze_tree test file). I found no significant difference in parse time. It also runs a very complete test of a large combination of percent array formatting styles, and shows which ones fail. Similar to the 'BUILT_IN' constants PR, it loads a string (instead of an array) with all the failures. Current code fails on any percent arrays ending in '\n ]' or any other terminator. Line 273 of Just wondering what tests to remove, or, should I do a PR with a new test based on the above code and you can remove what you want? |
Let's keep all existing tests. If you want to add a new suite of tests I can take a look in the PR. Thanks! |
Oh, also, it might be worth checking if this resolves the related #894 issue. It seems like a similar off-by-1. |
Sidenote (sorry for bunch of messages): make sure to rebase off of the master branch. I added rubocop linting to the build yesterday which should enforce some style rules. |
Done. I'm freezing. Added one big test with a fail message. You might run tests with
commented out, as that disables the patch, then you'll see the error message. Since I've obviously gotten familiar with the parser, I'll have a look at #894. |
Closing out some old issues. Given the significant age of this, it would be best to re-open with new context if it's still relevant. |
YARD does not parse some constant or class variables 'values' correctly.
Steps to reproduce
Following code shows the issue, which originate in the parser. Last case shown is the only one that fails.
Note that the only case which fails is a constant/cvar formatted as below
Critical issue is that the closing character must be on a new line and be indented.
The PR I spoke of earlier operated in the handlers. You may be able to fix the issue in the parser now that it's clear exactly what fails.
Environment details:
I have read the Contributing Guide.
The text was updated successfully, but these errors were encountered: