Jump to content

About pygments support


zackz
 Share

Recommended Posts

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 :)

Link to comment
Share on other sites

  • Moderators

zackz,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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".

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...