'{0}' label is not shown anymore
Previously, '{0}' would be labelled as '-1 Times', which is not actually the case. Also I am not sure to best visualize such a pattern, right now, except for the label, 'a{0}' looks similar to 'a?', even though they don't have the same effect.
This commit is contained in:
parent
98d2f94a3a
commit
b08a9d95f7
@ -54,6 +54,13 @@ describe('parser/javascript/repeat.js', function() {
|
|||||||
hasSkip: false,
|
hasSkip: false,
|
||||||
hasLoop: false
|
hasLoop: false
|
||||||
},
|
},
|
||||||
|
'{0}': {
|
||||||
|
minimum: 0,
|
||||||
|
maximum: 0,
|
||||||
|
greedy: true,
|
||||||
|
hasSkip: true,
|
||||||
|
hasLoop: false
|
||||||
|
},
|
||||||
'{1}?': {
|
'{1}?': {
|
||||||
minimum: 1,
|
minimum: 1,
|
||||||
maximum: 1,
|
maximum: 1,
|
||||||
@ -202,6 +209,11 @@ describe('parser/javascript/repeat.js', function() {
|
|||||||
maximum: -1,
|
maximum: -1,
|
||||||
label: undefined
|
label: undefined
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
minimum: 0,
|
||||||
|
maximum: 0,
|
||||||
|
label: undefined
|
||||||
|
},
|
||||||
{
|
{
|
||||||
minimum: 2,
|
minimum: 2,
|
||||||
maximum: -1,
|
maximum: -1,
|
||||||
|
@ -33,6 +33,9 @@ export default {
|
|||||||
label: {
|
label: {
|
||||||
get: function() {
|
get: function() {
|
||||||
if (this.minimum === this.maximum) {
|
if (this.minimum === this.maximum) {
|
||||||
|
if (this.minimum === 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
return formatTimes(this.minimum - 1);
|
return formatTimes(this.minimum - 1);
|
||||||
} else if (this.minimum <= 1 && this.maximum >= 2) {
|
} else if (this.minimum <= 1 && this.maximum >= 2) {
|
||||||
return `at most ${formatTimes(this.maximum - 1)}`;
|
return `at most ${formatTimes(this.maximum - 1)}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user