• Announcements

Sign in to follow this  
Followers 0

About pygments support

6 posts in this topic

Posted · Report post

I think maybe should post this topic to "Developer Chat", but I can't... :-(

Recently I put my script on github. But github not show au3 file with syntax highlighting, just raw text no color - https://github.com/zackz/PuTTYAssist/blob/master/PuTTYAssist.au3
After some digging I found:
* github use pygments for syntax highlighting, and github will support au3 if pygments support it, http://help.github.com/common-issues-and-questions/
* dozens of autoit project are already on github, they need syntax highlighting, https://github.com/search?langOverride=...it&repo=&start_value=1&type=Re
* pygments 1.4 (released Jan 03, 2011) starts support Autohotkey, so ahk file in github has syntax highlighting, https://bitbucket.org/birkenfeld/pygments-main/src/81d98983fd7f/CHANGES

Don't know whether autoit team are working on or considering about pygments. Hope github support au3 highlighting soon..
If there is a problem with github/pygments or python about highlighting, please let me know, maybe I can help :)

Share this post


Link to post
Share on other sites



Posted · Report post

zackz,

"Ask and you shall receive".... :)

M23

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks Melba23
Again, if anything I can help, please let me know.

Share this post


Link to post
Share on other sites

Posted · Report post

zackz,

Just to be sure you understand, I was only referring to moving the thread into this forum. I am not doing anything about "pygments" - I do not even know what they are (and please do not bother to explain :)).

M23

Share this post


Link to post
Share on other sites

Posted · Report post

Just to be sure you understand, I was only referring to moving the thread into this forum. I am not doing anything about "pygments" - I do not even know what they are (and please do not bother to explain ;)).

It's similar to geshi but with python, and even more languages supported. I'm sure it's not a big deal to write a lexer, they seem to have a good framework for it there, but I don't know how to get it up to the same standard as the geshi we use (with internal and UDF functions highlighted differently and linked, some preprocessors handled differently like #include, and even send special strings highlighted (or is that just SciTE)).

@OP, AutoIt would be fairly simple to implement... Provided you are not too fussy about getting it up to the forums standard. (see above)

Variable: "$w+"
Macro: "@w+"
Keyword/function "[_A-z]w+"
Number: "d+(.d+)?(e(+|-)?d+)"
HexNumber: "0[xX][[:xdigit:]]+"
Comment: ";[^n]*"
Preprocessor: "#[^n]*"
DoubleString: ""/*?"" (note this should work because even if you double up the quotes it will look the same :) )
SingleString: "'.*?'"

Probably a few more as well, but AutoIt is fairly simple for the basic lexemes as you know the token by the first character usually. Above regexes are for AutoIt. No idea what engine python uses.

Mat

Share this post


Link to post
Share on other sites

Posted · Report post

Just to be sure you understand, I was only referring to moving the thread into this forum. I am not doing anything about "pygments" - I do not even know what they are (and please do not bother to explain ;)).

It's good thing you guys start talking about it. :)

Here is some lexers in pygments for reference
* DiffLexer - a "Hello world"ish lexer in pygments documents
* JavaLexer - quite simple one relative to Java's reputation
* CLexer - slightly bigger than JavaLexer but not so big as DelphiLexer

@Mat, it's make a basic lexer with regexs you listed, which totally fine with me.
About functions highlighted differently, I can't find different token about function in docs, just "Name.Function". Maybe should use "Name.Builtin" for internal functions.
And it seems to need to write a new "Formatter" for feature "linked functions".

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0