Go Back   Scooter Forums > Beyond Compare 3 Discussion > File Formats vs. Rules
Register FAQ Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 13-Dec-2007, 06:18 AM
Glyn Williams Glyn Williams is offline
Visitor
 
Join Date: Dec 2007
Location: Horsham, England
Posts: 7
Default Automatic handling of embedded language formats

This is a comment following on from the file format <=> session complaints from Marjolein Katsma posted with the important notice from Tim:-
http://www.scootersoftware.com/cirru...splay.php?f=12

Where mixed language formats are embedded within each other, such as HTML in PHP files and HTML in ASP files, then the language interpretation / highlighting falls down. One solution was to switch fiel formats depending on what you are looking at in the file.
I use the gvim editor a lot http://www.vim.org/index.php
That has a very simple, but extremely powerful concept in its language files - it knows from the language syntax what language you are now 'changing' to, and will therefore switch its highlighting to that new language. Likewise the new language has constructs that know when it is terminating back to another language.
Thus, when I look at a PHP file, the HTML parts are highlighted as per the HTML syntax, and the PHP parts as per the PHP syntax. SQL statements are highlighted using SQL syntax rules.

Perhaps a future release could extend the file formats so that it knows the syntax for embedding other languages, and will switch to that other file format (on a stack basis), switching back when the other format reaches an 'end' syntax.

Use of such an automatic feature will make PHP, ASP, etc far easier to compare.
Reply With Quote
  #2  
Old 18-Dec-2007, 03:25 PM
Chris Chris is offline
Team Scooter
 
Join Date: Oct 2007
Location: Madison, WI
Posts: 3,792
Default

Glynn,

Thanks for the suggestion. I'll make a note for formats embedded within other formats on our wish list.
__________________
Chris K Scooter Software
Reply With Quote
  #3  
Old 23-Sep-2008, 10:28 AM
kjsmithtx kjsmithtx is offline
Journeyman
 
Join Date: Feb 2008
Posts: 18
Default

Is javascript embedded within comments in html going to eventually show as important differences? Currently, it displays as unimportant since it is within a comment section.
Reply With Quote
  #4  
Old 23-Sep-2008, 12:38 PM
Michael Bulgrien Michael Bulgrien is offline
Carpal Tunnel
 
Join Date: Oct 2007
Location: Pennsylvania
Posts: 1,766
Default

Whether or not embedded java scirpt is supported natively in the future, you're not without options, even now.

Option 1) For file types that you know will have embedded java, you can go into Session Settings under the Importance tab and check the importance checkbox in front of the Comment grammar element. This will make changes to comments important (whether or not they contain java code).

Option 2) You can create one or more regular expression grammar rules that detect java code within comments then move those grammar elements above the Comment grammar element in the importance list. This way, BC3 would only consider changes to comments as important if they contain detected java code. While option 2 will certainly be more difficult to implement, theoretically it is doable.
__________________
BC v3.3.5 build 15075
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 04:39 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.