View Full Version : Operation of Grammar
Stumpii
17-Apr-2008, 09:31 AM
I do not understand the new difference between grammar and unimportant text. The help file does not really give and details.
In BC2, I set an unimportant text regex entry as .*\[DESC\].* This would highlight the matching lines in blue in the file compare window and I could filter by differences which would keep them in view and toggle the 'unimportant differences' to hide them.
In BC3, I set the same entry as a grammar entry. In the file compare window, this line is now green. Any minor changes such as case are highlighted blue. Filtering by differences now makes the green disappear, so I can no longer check these unimportant differences. Toggling the 'unimportant differences' option removes the blue items as in BC2.
maurice
17-Apr-2008, 03:33 PM
This is confusing to me also. I have several similar "unimportant text" rules that BC3 did not seem to be using. Here's what I did that worked for me.
From a file compare window (I don't know any other way to access) bring up the Session Settings window (Session > Session Settings -or- click referee), then click Importance tab...uncheck "String". This seems a little odd to say (when checked) that all strings are important....so ignore my "Grammar" rules for strings.
Also, all my "rules" are of the type "String=Text matching...." but at least for now, BC3 doesn't remember the last type you created so I have to change from "new element" to "string" every time!
Also, it seems to me that it takes far too long to get to the "Grammar" tab. In BC2, from a file compare window, click on the Ref and you get the current rules (note - Ref tool tip says "Change Rules"!!)
In BC3, from a file compare window, Ref tool tip says "Rules", but clicking brings up Session Settings. The only way I can get what I need is Tools > File Formats. Currently no toolbar option for this, but you may be able to add a hot key.
grunt
08-May-2008, 04:09 AM
i'm struggling with this issue right now...
bc3 dev team (ui designer in particular, if there is, in fact, one poor soul tasked with that): you must have done something wrong with this in bc3 because its usability sucks. if you forced me to open the manual (much less visit your support forums!) afaic - you failed as a ui designer, simple as that.
nothing personal, ok? imo, not sucking at ui design is harder than not sucking at plain coding, but that's one of the things it takes to make great product.
Chris
08-May-2008, 11:10 AM
Grunt,
Thanks again for the feedback on this. We will work on this design one more time before the official release of BC 3.0.
Please see my post in the other recent format/unimportant text thread for an explanation of marking text unimportant.
http://www.scootersoftware.com/beta3/vbulletin/showpost.php?p=2277&postcount=6
aid9035
27-May-2008, 02:57 PM
RE: Grammer item definition and whether a particular item is or is not important (Build 456).
First, I think the idea of defining grammer items is great; however, a given grammer item may be entirely irrelevant to importance. For example, the user may only want that item to apply in syntax highlighting (Options, File Views, Display), without any effect whatsoever on importance determination.
From what I can see, if there is a defined grammer item, then it is either important or unimportant (checked or unchecked, respectively). If there is a way to tell BC that an item is "irrelevant", I did not find it.
Otherwise, the ability in a BC3 "session" to pick and choose among predefined items offers great flexibility compared to BC2. I believe I had made some similar suggestion a few years ago. Thanks!
aid9035
28-May-2008, 07:07 AM
Oops! If I had been thinking about "grammarian", "grammatical" or even "Grammaticus", I wouldn't have misspelled "Grammar"! Too bad there isn't a blush-faced emoticon.
Michael Bulgrien
28-May-2008, 09:25 AM
Oops!
You can edit your post to correct mis-spellings.
I think leaving a grammar item's importance checkbox checked does what you're asking. Differences are important by default but an individual "unimportant" grammar item can override this. By leaving the item "important", it will get the syntax highlighting but be handled like default text.
aid9035
29-May-2008, 07:09 AM
OK - I guess I was changing too many things at one time when first setting up BC3. It also took me a bit to get used to checking important items in BC3 vs. specifying unimportant items in BC2.
It had seemed to me that both unimportant and important items were taking precedence over default text, but I reworked that example and verified that only the unchecked, unimportant items take precedence.
Jerry
mzel
19-Jun-2008, 04:15 PM
I have trouble adding my unimportant element.
I am trying to ignore the differences in the version control stamps. I am pretty good with regexes and ahd no problem with this back in BC2. No I followed the instructions by Chris, but it still does not work for me. When I uncheck my VersionStamp item in the grammar nothing happens. The line is still highlighted. When I go back to the session setting it is checked again.
Aaron
19-Jun-2008, 04:36 PM
It should not 'recheck.' The first step would be to troubleshoot why it would be rechecking the box after you have selected Ok. Then we can troubleshoot if the rule itself is working. If it is checked, then it will be important.
To clarify, you open your pair of files, then click the Referee button (or go to the Session menu -> Session Settings). Then go to the Importance tab. Uncheck your custom "versionstamp". click ok.
Then go back to the Session Settings and make sure the uncheck is still unchecked.
If it is not, please make sure you are using the most recent version (458 as of today) and send us your settings (Help menu->Support; Export) to support@scootersoftware.com
Which rule are you using with "Versionstamp"?
mzel
20-Jun-2008, 08:53 AM
Hey, Aaron.
I double checked this, and it keeps rechecking. The regex is working. I managed to get the line colored blue, but only till the next text view.
It is even stranger. I configured the rules the way you proposed, and went to the folder view. The pair was shown with the double tilde as expected. The next pair of the files, also .java which I also expected to be approx. equal was shown as non-equal, so I hit Ctrl+F5, but nothing changed.
I went into the second file pair, and the line was red, so I hit the Referee button, and it was there, checked. I hit cancel, went back to the folder view, and now the first pair was shown as non-equal too. The Versionstamp was checked in that pair too.
I do understand that this is a session-wide setting so I was surprised at the sequence of events.
I'll send you the config later on.
Aaron
20-Jun-2008, 09:56 AM
As a Session setting, for each new Session you open it will use that session's default settings. So if the default is for it to be Important, then each new pair of files will use that (until you change it for that session).
You can change the Session's defaults from the Home Screen by selecting the Session type under Edit Session Defaults at the top of the list.
Does that help?
Edit: Another place to change your Session Defaults: From within the session you just edited (an open pair of files) there is a Combobox at the bottom of the Session Settings dialog where you just changed the importance. It is set by default to For This View only, but can be changed to Edit Session Defaults. This will also set the Session Defaults.
mzel
20-Jun-2008, 10:19 AM
I guess not. I was within the same session. BTW, I sent you my config.
Aaron
20-Jun-2008, 10:56 AM
Thanks, mzel. I think the confusion comes from that in BC3 everything is a Session.
I notice your Text Compare default is Versionstamp = Important. That means for any new Text Compare Session you open, even from a Folder Compare Session, it will set that checkbox. To alter this behavior, you can either:
-Set the Session default. Then any Text Compare you open will use the defaults
-Open a Folder Compare, then open a Text Compare, go to the Session settings and uncheck the box. Then go down to the Combo Box at the bottom of the dialog. Because it is a child session, it will have a couple more options:
*For this View Only - only affects that open tab
*Use with these Files in parent session - uses for this particular file in the parent session
*use for all files in the parent session - uses this config for all files of this file extension in the parent session
*Update Defaults - same as going to the home screen and updating the default.
mzel
20-Jun-2008, 12:48 PM
Aaron,
May be I am doing something wrong, but here is what happens:
- I opened a session and am in the Folder view
- I double-clicked the file and went to the Text View
- Referee button -> VersionStamp uncheck -> OK
>>> The line is blue
- Ctrl+W, back to folder veiw
>>> The file pair is approx equal
- Double-click the pair again, back to the Text View
>>> The line is red
- Referee button -> VersionStamp is checked; Cancel
- Ctrl+W back to folder
>>> The file pair is non-equal
I tried the sequence with Save Session after the OK to no avail.
Aaron
20-Jun-2008, 01:10 PM
Aaron,
May be I am doing something wrong, but here is what happens:
- I opened a session and am in the Folder view
- I double-clicked the file and went to the Text View
- Referee button -> VersionStamp uncheck -> OK
>>> The line is blue
- Ctrl+W, back to folder veiw
>>> The file pair is approx equal
- Double-click the pair again, back to the Text View
>>> The line is red
- Referee button -> VersionStamp is checked; Cancel
- Ctrl+W back to folder
>>> The file pair is non-equal
I tried the sequence with Save Session after the OK to no avail.
Here's the step you are missing:
- I opened a session and am in the Folder view
- I double-clicked the file and went to the Text View
- Referee button -> VersionStamp uncheck
**Choose to use this in more than "Only This View" in the combo box at the bottom**
If you want it to always be this way, then you can just make it "Update Session Defaults" for all Text Compares. Otherwise, you can pick one of the other two options to affect only the parent Folder Compare.
- OK the new Session Settings
>>> The line is blue
- Ctrl+W, back to folder veiw
>>> The file pair is approx equal
- Double-click the pair again, back to the Text View
.
.
.
Remember, in BC3 everything is a Session. In some cases, it may be a 'child' Session, but it still has it's own set of Session specific settings. The Text Compare windows you launch are their own Sessions. They can be saved as such (and picked from your Session Manager/Home Screen).
For example, you could have 2 Text Compare Sessions saved on the Home Screen of the same two files. One that considers Versionstamp Unimportant, and one that considers Versionstamp Important. Similar to old BC2 Sessions, where you could have two Directory Viewer Session saved of the same two directories: one using a Binary Compare, and one using a Rules-based Compare.
mzel
20-Jun-2008, 01:34 PM
Ok, I see now. BTW if I choose the Use for all files within the parent sessioin, and com beack in agian, I see the Use for this view only again.
Thanks for your help!
muhqu
01-Aug-2008, 01:58 AM
Hi... I also/still have problems defining an unimportant grammar rule for CVS/SVN Keywords like $Id: $
example, I have code that looks like that...
<?
/**
* $Id: class_blabla.php 14958 2008-07-15 12:47:07Z someone $
*/
class Blabla {
...
For the SVN Keywords I have define a "text matching" (basic) rule:\$(Id|Author|Date):.+\$
I want all grammar elements to be important except these Keywords. So I also checked the "Comment" grammar element to be important. And here arises the problem: While the Comment is considered important, I would expect the nested SVN Keyword to be considered unimportant. But that is not the case. BC3 seems to not handle nested grammar matches, so the whole comment block is considered important and the grammar rule for the Keyword seems to be ignored.
Also, changing the order of the matching rules in the "Grammar" dialog doesn't seem to have any effect.
My current workaround is to remove the entire Comment=Text from /* to */ rule from the Grammar.
Any hints/ideas?
Erik
01-Aug-2008, 10:16 AM
BC3 does not support nested grammar items. Removing the comment definition is the way to get the behavior you're looking for.
Stoebi
02-Aug-2008, 05:06 AM
http://www.scootersoftware.com/beta3/vbulletin/showpost.php?p=2277&postcount=6
Hello,
thank you very much for this example. :)
My problem, example:
Left side:
Copyright 1995
Right side:
Copyright 1997
What is the correct input to ignore such lines also, please?
I've tried:
Text matching: Copyright 199.
and
Text matching: Copyright 199\d{1}
Checked Regular expression
But this line is not ignored, see attached image please.
Kind Regards,
Stoebi
Hi Stoebi,
The line is blue, which means BC correctly identifies it as an "unimportant" difference.
To ignore all unimportant differences, select View | Ignore Unimportant Differences. Or, use the toolbar button (squiggley equals sign).
Stoebi
02-Aug-2008, 11:05 AM
Thank you very much for your answer. My fault :(
Kind Regards,
Peter
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.