 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Nov 04, 2007 5:41 pm
Compatibility Report suggestion |
Please add %i, %j, %k, %l, etc in quotes to the list of things the compatibilty report finds. I have a number of instances in my scripts where they had to be put into quotes for zMud, and it would make life much easier to have the report point them out.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Nov 04, 2007 9:38 pm |
I wonder if he can do that, given that the CR isn't exactly tied into the parser. It's a sort of approximation, so there are things it just can't do that the real parser can.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Nov 04, 2007 11:17 pm |
I'm sure adding a regex for "%[ijklm]" wouldn't be too much trouble, or even "%[a-Z]".
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Nov 05, 2007 6:09 pm |
Yep, I can add that. As Fang mentioned, the Compatibility Report uses simple regular expressions to flag possible problems, so it's easy to add that to the list.
Also, if anyone ever comes up with a good Regular Expression to detect %1..%99 (and %i,%j, etc) within parenthesis that doesn't get fooled by stuff like this:
"text"%1"more text"
then let me know. I'm no expert on regular expressions, and while I'm sure I could figure it out, I just haven't given this a very high priority. But if anyone else is an expert on RegEx and already has a sample laying around that handles quote counting, let me know. |
|
|
 |
Rorso Wizard
Joined: 14 Oct 2000 Posts: 1368
|
Posted: Mon Nov 05, 2007 7:42 pm |
You could make a small lexer for it and it shouldn't get fooled.
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Nov 05, 2007 8:08 pm |
Quote: |
You could make a small lexer for it and it shouldn't get fooled. |
Well, that wouldn't be any different than just running the entire parser on it, which is the problem in the first place. If it was easy to detect with just a lexer, than the current parser could handle it and automatically convert it. But for most of the issues detected by the compatibility report, there is no obvious way to automatically detect or convert it. So that's why it just uses regular expressions and errs on the side of reporting too many issues, rather than missing some.
Also, running through the existing lexer is *much* slower than just matching some regexs. |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Nov 05, 2007 9:33 pm |
I don't think a straight regex will ever get it perfect, and I am quite happy with a few false matches. It might be useful to have the entire line displayed somewhere though.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Tue Nov 06, 2007 2:28 am |
Vijilante wrote: |
It might be useful to have the entire line displayed somewhere though. |
Good idea - display the line with the %1 in it, and we can see if it is in quotes easily. |
|
|
 |
|
|