Avoid capturing disabled items in comments
This commit is contained in:
parent
5d159851e5
commit
78b9428f4e
@ -629,8 +629,8 @@ var configuratorApp = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info.type) {
|
if (info.type) {
|
||||||
var comment = '';
|
|
||||||
// Get the end-of-line comment, if there is one
|
// Get the end-of-line comment, if there is one
|
||||||
|
var comment = '';
|
||||||
findDef = new RegExp('.*#define[ \\t].*/[/*]+[ \\t]*(.*)');
|
findDef = new RegExp('.*#define[ \\t].*/[/*]+[ \\t]*(.*)');
|
||||||
if (info.line.search(findDef) >= 0) {
|
if (info.line.search(findDef) >= 0) {
|
||||||
comment = info.line.replace(findDef, '$1');
|
comment = info.line.replace(findDef, '$1');
|
||||||
@ -638,12 +638,15 @@ var configuratorApp = (function(){
|
|||||||
else {
|
else {
|
||||||
// Get all the comments immediately before the item
|
// Get all the comments immediately before the item
|
||||||
var r, s;
|
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)) {
|
if (r = findDef.exec(txt)) {
|
||||||
findDef = new RegExp('^[ \\t]*//+[ \\t]*([^#].*)[ \\t]*$', 'gm');
|
findDef = new RegExp('^[ \\t]*(//+[ \\t]*.*)[ \\t]*$', 'gm');
|
||||||
while((s = findDef.exec(r[0])) !== null) {
|
while((s = findDef.exec(r[1])) !== null) {
|
||||||
if (s[1].match(/\/\/[ \\t]*#define/) == null)
|
if (s[1].match(/^\/\/[ \\t]*#define[ \\t]/) != null) {
|
||||||
comment += s[1] + "\n";
|
comment = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
comment += s[1] + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user