AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Regarding certain statements and such. (https://forums.alliedmods.net/showthread.php?t=290634)

404UserNotFound 11-18-2016 21:02

Regarding certain statements and such.
 
So I'm currently working on a Notepad++ syntax highlighting project to create a new syntax highlighting setup for SourcePawn. I'm basing most of it off of Notepad++'s stock C++ highlighting. Here's how I've organized things like statements thus far.

Keywords1: new for if else do while switch case default return break continue sizeof true false typedef delete

Keywords2: Plugin Action void int float char bool Float String any Handle decl stock forward funcenum functag native function methodmap property typeset view_as cast_as var let public const enum static union struct

And for operators, I've got the following:
Code:

<Keywords name="Operators1">! @ % ^ &amp; * ( ) - | || = + ~ [ ] . , : ; / &lt; &gt; &lt;= =&lt; &gt;= =&gt; ?</Keywords>
<Keywords name="Operators2"></Keywords> // Empty

Is there anything I'm missing from these? Also, is there anything that SourcePawn as a language doesn't use that I should remove? I want to make sure I'm not missing anything before I start adding in .inc file class/type highlighting.

Here's what I've got style-wise so far. I plan to release this once I finish it. Also, I'm open to suggestions about the highlighting color/bold/etc of specific things.
- My highlighting (font is Inconsolata, before you even ask :P)
- Notepad++'s stock C++ highlighting, for comparison

blaacky 11-20-2016 00:07

Re: Regarding certain statements and such.
 
Maybe << and >>?

shavit 11-20-2016 00:49

Re: Regarding certain statements and such.
 
Quote:

Originally Posted by abrandnewday (Post 2471397)
I'll add those in under...er...operators, I assume? I do want to release this highlighting thing when I finish it so I want it to be as complete as possible.

I'm also looking into utilizing some regex expressions in Notepad++'s functionList.xml file to allow for highlighting of certain things similar to how Notepad++ does highlighting for languages such as CPP. It's been really quite interesting learning regex because I always saw it as a confusing clusterfuck of symbols.

I believe << and >> are used to shift.
< and > are operators.

Powerlord 11-20-2016 01:12

Re: Regarding certain statements and such.
 
Quote:

Originally Posted by shavit (Post 2471399)
I believe << and >> are used to shift.
< and > are operators.

...bit-shift operators are still operators.

Edit: For that matter, ++ and -- are also operators

Maxximou5 11-20-2016 02:45

Re: Regarding certain statements and such.
 
You might as well add in such things as += and -= as well.

luki1412 11-20-2016 17:53

Re: Regarding certain statements and such.
 
Quote:

Originally Posted by abrandnewday (Post 2471415)
I was trying to remember what those two were.

https://en.wikipedia.org/wiki/Operat..._C_and_C%2B%2B

blaacky 11-20-2016 19:42

Re: Regarding certain statements and such.
 
And /=, *= ^=, &=, |=, <<=, >>=, %=

klippy 11-21-2016 04:21

Re: Regarding certain statements and such.
 
SourcePawn should have (AMXX Pawn does) >>> and >>>= operators too. Can't test right now, I'm on phone.

EDIT:
Just tested it, works.

klippy 11-21-2016 16:31

Re: Regarding certain statements and such.
 
There is no left arithmetic shift. :)

Powerlord 11-21-2016 16:49

Re: Regarding certain statements and such.
 
Quote:

Originally Posted by KliPPy (Post 2471796)
There is no left arithmetic shift. :)

Which makes sense if you know what right arithmetic shift does.

i.e. it makes the number keep the same sign in a Two's Complement number system, which is what Pawn, C, C++, Java, etc... use.

However, that doesn't work in the other direction.


All times are GMT -4. The time now is 17:57.

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