Skip to content
Snippets Groups Projects
Commit 292fa94a authored by deuce's avatar deuce
Browse files

We no longer need an explicit test against "<?xjs" and "<?" since we check

for it at the end of the line.

Prevent zero-length write()s in that case.
parent 963dde12
No related branches found
No related tags found
No related merge requests found
......@@ -45,33 +45,28 @@ function xjs_compile(filename) {
var str=text[line];
while(str != '') {
if(!in_xjs) {
if(str=='<?xjs' || str=='<?') {
in_xjs=true;
if(str.search(/<\?(xjs)?\s+/)==-1) {
if(str.substr(-5)=='<?xjs') {
str=str.substr(0, str.length-5);
in_xjs=true;
}
if(str.substr(-2)=='<?') {
str=str.substr(0, str.length-2);
in_xjs=true;
}
if(str != '')
script += "writeln("+str.toSource()+");";
str='';
}
else {
if(str.search(/<\?(xjs)?\s+/)==-1) {
if(str.substr(-5)=='<?xjs') {
str=str.substr(0, str.length-5);
in_xjs=true;
}
if(str.substr(-2)=='<?') {
str=str.substr(0, str.length-2);
str=str.replace(/^(.*?)<\?(xjs)?\s+/,
function (str, p1, p2, offset, s) {
if(p1 != '')
script += "write("+p1.toSource()+");";
in_xjs=true;
return '';
}
script += "writeln("+str.toSource()+");";
str='';
}
else {
str=str.replace(/^(.*?)<\?(xjs)?\s+/,
function (str, p1, p2, offset, s) {
if(p1 != '')
script += "write("+p1.toSource()+");";
in_xjs=true;
return '';
}
);
}
);
}
}
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment