Avoid capturing disabled items in comments

This commit is contained in:
Scott Lahteine 2015-02-07 10:34:16 -08:00
parent 5d159851e5
commit 78b9428f4e

View File

@ -629,8 +629,8 @@ var configuratorApp = (function(){
}
if (info.type) {
var comment = '';
// Get the end-of-line comment, if there is one
var comment = '';
findDef = new RegExp('.*#define[ \\t].*/[/*]+[ \\t]*(.*)');
if (info.line.search(findDef) >= 0) {
comment = info.line.replace(findDef, '$1');
@ -638,11 +638,14 @@ var configuratorApp = (function(){
else {
// Get all the comments immediately before the item
var r, s;
findDef = new RegExp('([ \\t]*(//|#)[^\n]+\n){1,4}\\s{0,1}' + info.line, 'g');
findDef = new RegExp('(([ \\t]*(//|#)[^\n]+\n){1,4})([ \\t]*\n){0,1}' + info.line, 'g');
if (r = findDef.exec(txt)) {
findDef = new RegExp('^[ \\t]*//+[ \\t]*([^#].*)[ \\t]*$', 'gm');
while((s = findDef.exec(r[0])) !== null) {
if (s[1].match(/\/\/[ \\t]*#define/) == null)
findDef = new RegExp('^[ \\t]*(//+[ \\t]*.*)[ \\t]*$', 'gm');
while((s = findDef.exec(r[1])) !== null) {
if (s[1].match(/^\/\/[ \\t]*#define[ \\t]/) != null) {
comment = '';
break;
}
comment += s[1] + "\n";
}
}