rem: var lastIndex = commandOrCommentRegexp.lastIndex; 
add: lastIndex = commandOrCommentRegexp.lastIndex; 
context: function parse(testCase, source) {	var commandRegexp = new RegExp(options.commandLoadPattern, 'i');	var commentRegexp = new RegExp(options.commentLoadPattern, 'i');	var commandOrCommentRegexp = new RegExp("((" + options.commandLoadPattern + ")|(" + options.commentLoadPattern + "))", 'ig');	var doc = source;	var commands = [];	var commandFound = false;	while (true) {		//log.debug("doc=" + doc + ", commandRegexp=" + commandRegexp);		var lastIndex = commandOrCommentRegexp.lastIndex;		var docResult = commandOrCommentRegexp.exec(doc);		if (docResult) {			if (docResult[2]) { // command				var command = new Command();				command.skip = docResult.index - lastIndex;				command.index = lastIndex;				var result = commandRegexp.exec(doc.substring(lastIndex));				eval(options.commandLoadScript);				convertText(command, decodeText);				commands.push(command);				if (!commandFound) {					// remove comments before the first command or comment					for (var i = commands.length - 1; i >= 0; i--) {						if (commands[i].skip > 0) {							commands.splice(0, i);							break;						}					}					testCase.header = doc.substr(0, commands[0].index);					commandFound = true;				}			} else { // comment				var comment = new Comment();				comment.skip = docResult.index - lastIndex;				comment.index = docResult.index;				var result = commentRegexp.exec(doc.substring(lastIndex));				eval(options.commentLoadScript);				commands.push(comment);			}		} else {			break;		}	}	if (commands.length > 0) {		testCase.footer = doc.substring(commandOrCommentRegexp.lastIndex);		//log.debug("header=" + this.header);		//log.debug("footer=" + this.footer);		//log.debug("commands.length=" + commands.length);		testCase.commands = commands;	} else {		throw "no command found";	}}
meta: 3428	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3428/57e82436dfcb749a0e13ead9ebe1dd5a149954b6/html.js/buggy/src/content/formats/html.js