Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] code coloring in the js editor with regexp

Hmm.. we js does have a AST now so i dont know if we could intergrate coloring with it?
 
johan


 
On Mon, May 4, 2009 at 16:42, Alex Panchenko <alex@xxxxxxxxx> wrote:
Hi all,

I suppose the most reliable solution is re-color everything using semantic highlighting based on AST.
Scripting languages usually have complex syntax, so one should repeat parser logic using scanner rules, but it's not an easy task.
For simple rules based on heuristics it is usually possible to create the example that is not highlighted correctly.

Regards,
Alex


----- Original Message -----
From: "Jae Gangemi" <jgangemi@xxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Monday, May 4, 2009 9:24:08 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] code coloring in the js editor with regexp


  i had this same problem. i solved it by creating additional document partitions for strings and regexps (w/ the regexp rule taking priority over the string rule) and wiring up a 'color' token to the specific document partition.

On Mon, May 4, 2009 at 10:14 AM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
Hi,
 
dont know about other languages so i first ask if this is know or already working in other implementations.
If you have this:
 
 var myData = globals.curChartDataHTML.replace(/[^<]*(<a href="" '$5'); 
 var installdir = java.lang.System.getProperty("user.dir");
 installdir = utils.stringReplace(installdir,'\\','\/');
 
then the color coding in the script editor is wrong because it sees in the regexp a opening " without an ending so everything after that is marked as a string.
 
Do other scripting languages also work with regexp like that?
I guess i need to have a scanner that sees / xxx /g as there own thing?
 
johan
 

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
-jae

_______________________________________________ dltk-dev mailing list dltk-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dltk-dev

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



Back to the top