screenshot here
In the above screenshot..
My comment color (red) is going good up to line 151.
Notice that on line 155 the comment color has switched to the string color (purple)
Resaon being that line 153 is a regex with three double quotes> $item =~ /"([^"]+)"/;
TP is thinking that the third " in the regex starts a string and everything until the next " is colored purple..
Look at line 164.. print is a keyword and should be blue... but because its part of the assumed string up to the matching " just after print, it is also colored purple.
At the end of that line (164) is another keyword (if) which should also be blue, but because a " is just in front , TP assumes another string has started and colored it purple.
Everything went out of sync till end of file..
Syntax color: feature, bug or style?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
TextPad's syntax analyser can cope with most programming languages, but some, such as Perl, have constructs that require a full semantic analysis, to determine the context. If regular expressions were always written as /.../ it would be easy, but as Larry Wall is so fond of saying, "There's more than one way to do it". We considered that a semantic analysis would be overkill for a general purpose text editor, and would slow everything else up, so didn't implement it.
You'll often see the following workaround in Perl scripts, to allow for all the text editors that get out of sync when parsing quotes:
$item =~ /"([^"]+)"/; # "
The commented out quote keeps both Perl and TextPad happy.
Keith MacDonald
Helios Software Solutions
You'll often see the following workaround in Perl scripts, to allow for all the text editors that get out of sync when parsing quotes:
$item =~ /"([^"]+)"/; # "
The commented out quote keeps both Perl and TextPad happy.
Keith MacDonald
Helios Software Solutions
Good one Keith, figured that I had to inject a #" somewhere to even the equation..
/#*
the ability
to comment
multiple lines
*#/
What was he thinking?
Thats true for 99% of Perl .. except that the 1% he didnt figure is the most annoying ...but as Larry Wall is so fond of saying, "There's more than one way to do it"
/#*
the ability
to comment
multiple lines
*#/
What was he thinking?
I have a similar problem with syntax highlighting for SAS. In SAS, an asterisk can be a multiplication operator and a comment starting character. TextPad can't recognize both, and I have to live with it.
For example:
a = b * c; * This is a comment;
The first asterisk shows multiplication, the second one starts the comment. To make TextPad to display proper colours, I double the comment asterisk:
a = b * c; ** This is a comment;
and define alternate comment starting with 2 asterisks. That's why I asked how to change one asterisk with two a little while back.
For example:
a = b * c; * This is a comment;
The first asterisk shows multiplication, the second one starts the comment. To make TextPad to display proper colours, I double the comment asterisk:
a = b * c; ** This is a comment;
and define alternate comment starting with 2 asterisks. That's why I asked how to change one asterisk with two a little while back.
is this the latest ver?
I see that on line 142, where you get the scalar of your list, that your textpad colors this as a comment. I recall that this was changed (I think in a bug fix) so that a comment starting other than as a newline is not recognized unless preceeded by a <space> char.
I tried your line 142 on my textpad and did not get comment color there unless I put a <space> between the '$' and the '#'.
I'm running 4.7 and was wondering if you're on 4.7.1 or something else.
I tried your line 142 on my textpad and did not get comment color there unless I put a <space> between the '$' and the '#'.
I'm running 4.7 and was wondering if you're on 4.7.1 or something else.
comment color at $#listvar
OK, looks like I better wait to update then.