Closed smart--petea closed 10 years ago
I do not know if it is the case. In mocha-tests branch the regexp was defined in the module and used by parser from closure every time it is needed.
If you want to improve the preciousness of regexp then it can be tied to the file which is parsed. I see next steps for strike this goal:
_(files).where(function(f) { return f.match(/\.js$/i); }).forEach(function(fname) {
with
_(files).where(function(f) { return /\(.*?).js$/i.exec(f); }).forEach(function(fileInfo) {
where (if successful case) fileInfo = [ filePath, className]
regExp = new RegExp("@endpoint\\s*\\((url:.+)\\s*(method:.+)\\)[\\s\\n]*" + className + "\\.prototype\\.([^\\s]*)", "gim")
Closing this since I've followed your advise and improved the regex.
Regexp for endpoint (from mocha-tests branch) is
It can be transformed to
[\s\n]* - I do not know the distance between @endpoint statement and function declaration [^\s]* - class name ([^\s]*) - method name
In this case this snippet
become