added options.antlr to support antlr syntax#7
added options.antlr to support antlr syntax#7peterremote1980 wants to merge 6 commits intomicromatch:masterfrom
Conversation
tunnckoCore
left a comment
There was a problem hiding this comment.
-
README file is generated from the code comments and
.verb.mdso it's better to add the docs there. -
why removing the
is-number? I'm not sure if the added isNumber function will behave as the package. As I remember this package is battle tested and used for a reason.
|
I'm really sorry I missed this PR! I don't know how I didn't see it until now. I'll review ASAP! |
| let onlyPositive; | ||
| let intersected; | ||
| if (options.antlr){ | ||
| onlyNegative = filterPatterns(neg, pos, "'-'", false, options) || []; |
There was a problem hiding this comment.
Seems like this would be better to do in filterPatterns, so it only needs to be done one time.
|
|
||
| function isNumber(n){ | ||
| var re = new RegExp('^-?[0-9]+$'); | ||
| //console.log(n+'='+re.test(n)); |
There was a problem hiding this comment.
please remove all temporary code comments
| return subpatterns.join('|'); | ||
| if (options.antlr){ | ||
| return subpatterns.join('\n|'); | ||
| }else{ |
There was a problem hiding this comment.
Please run eslint to get reports on formatting inconsistencies.
| @@ -0,0 +1,4 @@ | |||
| const toRegexRange = require('./'); | |||
| var source = toRegexRange('-128', '127', {capture: true, antlr: true}); | |||
| console.log("-128 -> 127 = "+source); | |||
There was a problem hiding this comment.
Unit tests should use assertions. Please see the test/test.js file for examples of how tests are done. I would be happy to help if you have questions.
added options.antlr to support antlr syntax