Raised This Month: $32 Target: $400
 8% 

AMXX Keywords for Syntax Highlighting


Post New Thread Reply   
 
Thread Tools Display Modes
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 03-06-2009 , 23:46   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
prototypes? Do you mean native, public, and stock? (Those three are grouped together.
No, the arguments that each function takes.
__________________

Community / No support through PM
danielkza is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-07-2009 , 01:41   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #12

Quote:
Originally Posted by danielkza View Post
No, the arguments that each function takes.
Oh, ok. I'll look into that . If I don't come up with something soon I will post my current php files so you can use/modify them as you like.
__________________
fysiks is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 03-08-2009 , 14:49   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #13

Here's my attempt. (Attached as ini rather than txt to get past the filesize limit.)

My regex:

Code:
Function:
^(?:stock Handle:|	XS_LIBFUNC_ATTRIB bool:|	XS_LIBFUNC_ATTRIB Float:|	XS_LIBFUNC_ATTRIB |	stock Float:|	stock bool:|	stock |stock Float:|stock bool:|forward |native bool:|native Float:|native |public |stock |Float:|bool:)?([\w_\-\d]+)[\s]?(\(.*?\))

Constant:
^(?:#define|new const)\s+([^_][A-Z\d_]+)

Macro:
^(?:#define|new const)\s+([^_][\w\d_]+\(.*?\))

enum: (Once I've collected all the enums sloppily, I use this to refine the collection.)
^\s([\w\d_-]{2,64})
EDIT: Added some enums
Attached Files
File Type: ini constants.ini (12.4 KB, 213 views)
File Type: ini macros.ini (895 Bytes, 191 views)
File Type: ini functions.ini (21.6 KB, 192 views)
File Type: ini functions with prototypes.ini (54.7 KB, 231 views)
File Type: ini enums.ini (12.8 KB, 188 views)
__________________

Last edited by stupok; 03-09-2009 at 00:58. Reason: some more
stupok is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-09-2009 , 00:14   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #14

Only 800 constants? There are like 2000. I think you missed all the enum's.

Are you using POSIX Extended or PCRE?

I didn't know what XS_LIBFUNC_ATTRIB meant. I guess I will have to add that to my regex

-
__________________

Last edited by fysiks; 03-09-2009 at 01:09.
fysiks is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 03-09-2009 , 00:57   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #15

I did miss all the enums. Have a look at my regular expressions. I'm pretty sure they catch everything, but I'm not going to check.

I bet there's a way to do this without searching through the amxx includes.

POSIX Extended or PCRE?
I don't know.
__________________
stupok is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-09-2009 , 01:13   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #16

This is what I came up with for Danielkza here.

Quote:
Originally Posted by stupok View Post
I bet there's a way to do this without searching through the amxx includes.
How? Using the func wiki maybe but I don't have access to that code .

Quote:
Originally Posted by stupok View Post
POSIX Extended or PCRE?
I don't know.
POSIX is a standard (syntax) for regex basically. PCRE = Perl Compatible Regular Expression. I think you are using POSIX because you don't escape the underscore (_).
__________________
fysiks is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 03-09-2009 , 17:28   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #17

Quote:
Originally Posted by fysiks View Post
This is what I came up with for Danielkza here.



How? Using the func wiki maybe but I don't have access to that code .



POSIX is a standard (syntax) for regex basically. PCRE = Perl Compatible Regular Expression. I think you are using POSIX because you don't escape the underscore (_).
I don't think underscore is a special character in PCRE, and even if it was, it looses the special meaning inside a char. class.
__________________

Community / No support through PM
danielkza is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-10-2009 , 10:44   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #18

Darn, found 1 thing bad about the PortableApps.com version of NP++, I had to add all of this manually (using the user define option in the menus). Oh well, at least I can use a menu feature to edit the colour scheme instead of editing a file each time (the changes take effect immediately with the menu)

EDIT: Hm, I found the location, guess I had issues with that install as it works on a reinstall (I was putting it in that location, but it wasn't working for some reason). Also, I got a compiler working for NotePad++, here is how you can do it to.

In the same location as the userDefineLang.xml, there should be a file named shortcuts.xml. Edit that file and put this (full file contents shown, place it appropriatly in your file)

Code:
<NotepadPlus>
    <UserDefinedCommands>
        <Command name="Compile Plugin" Ctrl="yes" Alt="no" Shift="yes" Key="67">cmd /k .\..\..\..\..\..\Compiler\amxxpc.exe -o$(CURRENT_DIRECTORY)\$(NAME_PART).amxx $(FULL_CURRENT_PATH)</Command>
    </UserDefinedCommands>
</NotepadPlus>
Change ".\..\..\..\..\..\Compiler\amxxpc.exe" to the location of your amxxpc.exe file. Since I use PortableApps, I can't use a exact path but you can if you want. This will compile the current active window and place the AMXX file in the same folder as the SMA file. This also leaves the cmd window open.

Default shortcut key is SHIFT+CTRL+C. You can change this in Settings>Shorcut Mapper...>Run Commands>Compile Plugin (or whatever the name of the command is)
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 03-11-2009 at 12:42.
YamiKaitou is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-10-2009 , 13:22   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #19

Sweet! I've been hoping for a way to compile my plugins this way.

Although, now, I do all my compiling on my linux server with a script that will move the amxx to my plugins directory automatically if it compiles successfully.
__________________
fysiks is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-10-2009 , 14:14   Re: AMXX Keywords for Syntax Highlighting
Reply With Quote #20

You can always use it to test plugins as you are writing them. Surely all of your plugins don't compile 100% of the time when you put them on your server.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode