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

Making REGEX_OPTIONAL greedy #262

Merged
merged 1 commit into from
Nov 6, 2014
Merged

Making REGEX_OPTIONAL greedy #262

merged 1 commit into from
Nov 6, 2014

Conversation

timdp
Copy link

@timdp timdp commented Sep 30, 2014

Allows for arrays in default values for optional arguments. E.g., @param {Array} [arr=[]]. The current version would leave out the closing bracket.

@okuryu
Copy link
Member

okuryu commented Nov 3, 2014

@timdp Thanks for your contributions! I'm not able to reproduce your problem. Could you provide example code which occurs the problem?

@timdp
Copy link
Author

timdp commented Nov 3, 2014

Does @param {Array} [arr=[]] produce the right output for you? With the existing regexp, we would get arr=[ without the matching brace.

@okuryu
Copy link
Member

okuryu commented Nov 4, 2014

Sorry! I just confirmed your problem and it was resolved by your patch. So here is my example code (index.js).

/**
 * @module MyModule
 * @class MyClass
 */

/**
 * @method func1
 * @param {Array} [option1=[]] The option 1
 */
function func1(option1) {
}

The results by latest YUIDoc.

image

and data.json as follows.

$ cat out/data.json | jq .classitems[0].params[0].optdefault
"["

The results by your patch.

image

and data.json as follows.

$ cat out/data.json | jq .classitems[0].params[0].optdefault
"[]"

Am I correct?

@timdp
Copy link
Author

timdp commented Nov 4, 2014

Yep, that's what I had in mind.

@okuryu okuryu self-assigned this Nov 6, 2014
@yahoocla
Copy link

yahoocla commented Nov 6, 2014

CLA is valid!

@okuryu okuryu merged commit f4e599f into yui:master Nov 6, 2014
@okuryu
Copy link
Member

okuryu commented Nov 6, 2014

@timdp I just merged, thanks for your contribution!

@timdp
Copy link
Author

timdp commented Nov 8, 2014

You're welcome!

@timdp timdp deleted the default-allow-array branch November 8, 2014 17:56
@okuryu okuryu mentioned this pull request Nov 10, 2014
17 tasks
@okuryu okuryu added this to the v0.4.0 milestone Nov 28, 2014
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.

3 participants