Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

About pygments support


  • Please log in to reply
5 replies to this topic

#1 zackz

zackz

    Seeker

  • New Members
  • 4 posts

Posted 03 January 2012 - 01:36 PM

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







#2 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,018 posts

Posted 03 January 2012 - 02:02 PM

zackz,

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

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#3 zackz

zackz

    Seeker

  • New Members
  • 4 posts

Posted 03 January 2012 - 02:51 PM

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

#4 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,018 posts

Posted 03 January 2012 - 04:33 PM

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
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#5 Mat

Mat

    43 38 48 31 30 4E 34 4F 32

  • MVPs
  • 5,067 posts

Posted 03 January 2012 - 05:41 PM

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

#6 zackz

zackz

    Seeker

  • New Members
  • 4 posts

Posted 04 January 2012 - 02:51 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users