Hello,
I’d like to find out which are the necessary parts of the JS Mode in the sense of which parts do I really need for the minimum functionality of an editor…
@marijn - Could you explain?
Thanks!
Regards
Hello,
I’d like to find out which are the necessary parts of the JS Mode in the sense of which parts do I really need for the minimum functionality of an editor…
@marijn - Could you explain?
Thanks!
Regards
I don’t know what you mean, but this sounds like something that could be cleared up by reading the manual.
Well, alright - then please answer me just this question:
I’ve the string “–kommentar 1” which fits the regex: /^-{2}.*/
I’ve following check:
if(stream.match(/^-{2}.*/)){
return ret("comment", "comment");
}
As you can see I want to colorize the string “–kommentar 1” …
But I’ll never reach this return. The regex should work…
Can you tell me why?
Thanks.
Hello Marijn!
Since stream.match() didn’t work in my case - i used a workaround:
indent preformatted text by 4 spaces
var regexP = /P\./g;
var regexRSDot = /RS\.\w*/g;
var regexDTDot = /DT\./g;
var regexDT = /DT_\w*/;
var regexRS = /RS_\w*/;
var regexFOAB = /FO\(AB\w*/;
var string = stream.string;
//var string = stream.string.replace(/^"(.*)"$/, '$1');
var matchC = regexComment.exec(string);
var matchP = regexP.exec(string);
var matchRS = regexRS.exec(string);
var matchRSDot = regexRSDot.exec(string);
var matchDTDot = regexDTDot.exec(string);
var matchDT = regexDT.exec(string);
var matchFOAB = regexFOAB.exec(string);
//if(stream.match(/^-{2}.*/)){
if(matchC !== null){
return ret("comment", "comment");
}
if (matchP !== null) {
//var xp = stream.next();
stream.skipToEnd();
var z = stream.current();
return ret("atom", "atom");
}
if(matchRS !== null){
return ret("ruleset", "ruleset");
}
if(matchDT !== null){
return ret("ruleset", "ruleset");
}
if(matchDTDot !== null){
return ret("atom", "atom");
}
if(matchRSDot !== null){
return ret("atom", "atom");
}
if(matchFOAB !== null){
return ret("keyword", "keyword");
}
The Regex Pattern will be recognized now. But unfortunately the whole line will be colorized and not just a subset.
How can I manage this?
Thank you.
Regards