-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
added options.antlr to support antlr syntax #7
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
README file is generated from the code comments and
.verb.md
so 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove all temporary code comments
return subpatterns.join('|'); | ||
if (options.antlr){ | ||
return subpatterns.join('\n|'); | ||
}else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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