
Automatic coloring of comments in the code
It should be changed so comments that reside in the "code" "/code" section are colored automaticaly. The color can be set in options or can be hardcoded.
That will make scripts samples much readable, and understandable since you could understand separated parts of the script more easily.
Something like this: http://www.autohotke... ... 5333#75333
______________________________________________________
Current version of script:
Summary of my javascript, PhiLho copied my original code so most of it should apply to his:
Widely supported and cross-browser DOM compatible
Uses basic regex that all browsers should be able to handle
Predeclared and reused vars for speed
Only parses defined tags with the specified class (cont and cls vars) for memory utilization
Portable - use with the forum, docs and even your own site
Everything I mentioned earlier to Chris with added support for Opera's bad regex handling
Parses each code block in turn to prevent unresponsiveness
Highly compressible - 250 bytes with gzip lvl 2
Other benefits that I haven't thought of yet..
Titan's code            Philho's code:

nah...




Mmm, even this is not so simple, we still have to watch out for escapes, continuation sections, strings, etc.


PhilHo, that is the right reason to be concerned but I still think it is not too hard work... I don't know PHP but searching for comments in the text is something students usualy have to do for homework in first year of programming.
Also, I suspect that such representation of coded examples will influence the users to comment their code well

I agree that coloring the comments differently than the code would a great thing to have. In fact, it's a brilliant idea. Furthermore, I'd like to apply the same coloring scheme to all the examples in the help file, if possible.
Since green is a "whitish" color in the spectrum, it seems to me to be slightly harder to read than other "blackish" colors like blue and purple. In addition, green seems to be the traditional color for comments in IDEs like Visual Studio (and they usually study ergonomics to decide such things). For this reason, perhaps comments should be dark green and everything else in the code section (except where explicitly overridden by a [color] tag) should be black, purple, blue, or some other blackish color.
If anyone has time to work on this, I'd greatly appreciate it. Otherwise, I will add it to my list because I really love the idea.
Thanks.

It is not the question of knowing PHP but knowing AHK here...I don't know PHP but searching for comments in the text is something students usualy have to do for homework in first year of programming.
; This is a plain comment, easy to find a = Foo ; Another simple comment, all right b := "Foo ; This becomes a bit tricky" c = ( Continuation section ; This line ISN'T a comment... ) /* OK, these comments are straightforward to handle. */ d = "Foo ; This IS a comment..." MsgBox e := "Foo ; This IS a comment too!"Not so hard, not so simple, just a bit of work for tracking the current state and handling tricky cases. Much simplier than a full lexer, indeed.
Note: actually, unlike what I expected, the 'b' line raises a syntax error...
Bug or real intend, I don't know.
Chris, personnaly, I dislike using green for comments, I always change this setting in my editors to get some shade(s) of grey. I find this less distracting.
Along with comments, we could add support of commands and directives, although this is harder, and would probably lead to highlighting them in comments and strings, which isn't so problematic.


That should be an error. It is not a bug.b := "Foo ; This becomes a bit tricky"
This is not:
b := "Foo `; This becomes a bit tricky"
Huh.... this one is bad .... I thought at first that it is also an error for the same reason as in b (I didn't test it thogh) but I remember some sentence in the help that there is some special case for ; and I suspect this to be that one.d = "Foo ; This IS a comment..."
This is a comment ?MsgBox e := "Foo ; This IS a comment too!"
Who write comments like that

I agree, but please, don't insist since we already achieved something and this can turn Crhis off road.Along with comments, we could add support of commands and directives, although this is harder, and would probably lead to highlighting them in comments and strings, which isn't so problematic.

One step at the time.

Grey is good too and fits my green-theory because it's a color that has been skewed toward white and is thus (intentionally) a bit harder to read. We could have a poll to decide the defaults.Chris, personnaly, I dislike using green for comments, I always change this setting in my editors to get some shade(s) of grey.
This would be good, but I'm wary of scope-creep. For now, perhaps it should be limited to comments to make the work less daunting.Along with comments, we could add support of commands and directives, although this is harder, and would probably lead to highlighting them in comments and strings, which isn't so problematic.
The help file currently uses
sections for all code examples. Assumingdoesn't allow any kind of coloring or CSS inside it, this would have to be changed (which might be a good idea anyway because it might also allow a custom tab stop to be used via or other method). If anyone has ideas about this or would like to work on it (or the forum mod), please let me know. I believe phpBB already has a syntax highlighting mod/framework to which the syntax rules for a language can be applied.

I know, but in most languages I know, a comment symbol inside a string is just some more ordinary chars:That should be an error. It is not a bug.b := "Foo ; This becomes a bit tricky"
This is not:
b := "Foo `; This becomes a bit tricky"
a = "foo // bar" ; Lot of languages...
a = 'foo -- bar' ; Lua
a = "foo ' bar" ; VB
$a = "foo # bar" ; Perl
and so on, that's why I was surprised.


Well, Chris, relax a little, take your time, nobody will crossify you if you don't do your homework. After all, this should be something that you like to do and enjoy it. Don't make this important in the way you can't sleep cuz of it... I would like too see improvements in AHK but the last thing I want to see is you in depression because you are only a human.I forgot to add that although I really like the idea, it would take me away from development of other AHK features.
So, the directive from Belgrade is to relax !


I never pay much attention to comments syntax but you are probably right, and most of all it is logical to be that way.a comment symbol inside a string is just some more ordinary chars
2Chris
Are you sure that
doesn't use CSS ?
I would be quite surprised if it doesn't....
This is what I found googling:
[url=http://www.netmechanic.com/news/vol6/PRE_example_no9.htm]http://www.netmechanic.com/news/vol6/PR ... le_no9.htm[/url]
Source will show this:pre {font-weight:bold; color:maroon;}
