When editing a JavaScript code, the editor is losing track of code after a funcion that includes double backslash inside a regular expression, as explained below:
function nltoparag(txt){
txt = txt.replace(/\\/g, ""); <-- AFTER FIRST SLASH IS ALL YELLOW
var html = txt;
if(html.indexOf('<p>')==-1) { <-- AFTER < IS ALL BLACK AND AFTER QUOTE IS ALL GREEN
html = '<p>'+html+'</p>';
html = html.replace(/\n\r/g, '</p><p>'); <-- TEXT INSIDE QUOTES IS GREEN, SHOULD BE THE OPPOSITE
html = html.replace(/\r\n/g, '</p><p>');
html = html.replace(/\n/g, '</p><p>');
html = html.replace(/\r/g, '</p><p>');
}
return html;
}
function recursoExterno(titulo, html){
console.log("recursoExterno titulo: "+titulo);
console.log("recursoExterno titulo decoded: "+titulo.decodeHEX());
console.log("recursoExterno html: "+html);
console.log("recursoExterno html decoded: "+html.decodeHEX());
var Jan = new $Jan('geral?titulo="'+titulo.decodeHEX()+'"&x=10&y=10&l=640&a=480', html.decodeHEX());
}
I'll take a look, maybe I find the cause of this...
regex of javascript is most difficult pattern to do, because one need to look ahead for patterns, and bluefish scanning engine does not have this capability. I have spend significant amount of time on modifying javascript file patterns, and this is the best I could do.
There is javascript_syntax_highlighting_testfile.js having all difficult paterns, please add your patterns here.
The language files are located bluefish ▸ data ▸ bflang ▸ all-javascript.bfinc and javascript.bflang2
if you add space after \
txt = txt.replace(/\\ /g, "");
the highlighting works. So problems is that current language file does not handle \/ sequence correctly, assuming that \/ is escape sequence while it is regex close slash.
Thanks for your input, @Andrius! Where is this javascript_syntax_highlighting_testfile.js?
Its here:
https://sourceforge.net/p/bluefish/code/HEAD/tree/trunk/testfiles/javascript_syntax_highlighting_testfile.js