C++ Syntax highlighting?

Status
Not open for further replies.

Tru_Power22

You can change this now in User CP.
Reaction score
144
Well, I'm just thinking, we have it for Jass and PHP. But PHP tag isn't used a whole lot (I find). One that would be used much more is C++. I mean look at the programming forum. Ever second post is about C++ (or C#, but I mean they have nearly the same syntax, so I don't think it would matter).

[cpp]
#include <iostream>
int main()
{
std::cout << "I'm sad that this isn't real" << endl;
return 0;
}
[/cpp]

So is it possible to see some nice CPP tags in the future?
 

Vestras

Retired
Reaction score
248
Samuraid said:
If we wanted to support other language syntaxes, we'd need to mod the forums and use a syntax hilighter like GeSHi

I believe phyrex modded GeSHi to be faster (yeah, phyrex can do everything, lol) for the Jass highlighting, so why not modify it to also support other languages?

Tru_Power22 said:
they have nearly the same syntax

Syntax = no; keywords = yes :)

EDIT: Actually, since I also made a syntax highlighter, I have a list of C++ keywords, I guess I could contribute:
C++
Code:
          __cdecl
          __clrcall
          __declspec
          __fastcall
          __int32
          __int64
          __restrict
          __sptr
          __stdcall
          __thiscall
          __unaligned
          __uptr
          __w64
          and
          and_eq
          asm
          auto
          bitand
          bitor
          bool
          break
          case
          cast
          catch
          char
          class
          compl
          const
          const_cast
          continue
          default
          delete
          do
          double
          dynamic_cast
          else
          enum
          explicit
          export
          extern
          false
          float
          for
          friend
          goto
          if
          inline
          int
          long
          mutable
          namespace
          new
          not
          not_eq
          operator
          or
          or_eq
          private
          protected
          public
          register
          reinterpret_cast
          return
          short
          signed
          sizeof
          static
          static_cast
          struct
          switch
          template
          this
          throw
          true
          try
          typedef
          typeid
          typename
          union
          unsigned
          using
          virtual
          void
          volatile
          wchar_t
          while
          xor
          xor_eq

Oh, awesome, I have more :eek:

C#
Code:
          abstract
          event
          new
          struct
          as
          explicit
          null
          switch
          base
          extern
          object
          this
          bool
          false
          operator
          throw
          break
          finally
          out
          true
          byte
          fixed
          override
          try
          case
          float
          params
          typeof
          catch
          for
          private
          uint
          char
          foreach
          protected
          ulong
          checked
          goto
          public
          unchecked
          class
          if
          readonly
          unsafe
          const
          implicit
          ref
          ushort
          continue
          in
          return
          using
          decimal
          int
          sbyte
          virtual
          default
          interface
          sealed
          volatile
          delegate
          internal
          short
          void
          do
          is
          sizeof
          while
          double
          lock
          stackalloc
          else
          long
          static
          enum
          namespace
          string

VB.NET
Code:
Sub
Function
Property
Declare
Public
Private
Protected
Overrides
Shared
Event
Shadows
Friend
Dim
Global
Option
Explicit
Not
And
Xor
Or
String
Long
Integer
Boolean
Currency
Date
Byte
Single
Double
Static
As
Const
Inherits
Implements
kuko
Imports

VbCrLf
VbCr
VbLf

AddHandler 
AddressOf 
Alias 
And 
AndAlso 
Ansi 
As 
Assembly 
Auto 
Boolean 
ByRef 
Byte 
ByVal 
Call 
Case 
Catch 
CBool 
CByte 
CChar 
CDate 
CDec 
CDbl 
Char 
CInt 
Class 
CLng 
CObj 
Const 
CShort 
CSng 
CStr 
CType 
Date 
Decimal 
Declare 
Default 
Delegate 
Dim 
DirectCast 
Do 
Double 
Each 
Else 
ElseIf 
End 
Enum 
Erase 
Error 
Event 
Exit 
False 
Finally 
For 
Friend 
Function 
Get 
GetType 
GoTo 
Handles 
If 
Imports 
In 
Inherits 
Integer 
Interface 
Is 
Let 
Lib 
Like 
Long 
Loop 
Me 
Mod 
Module 
MustInherit 
MustOverride 
MyBase 
MyClass 
Namespace 
New 
Next 
Not 
Nothing 
NotInheritable 
NotOverridable 
Object 
On 
Option 
Optional 
Or 
OrElse 
Overloads 
Overridable 
Overrides 
ParamArray 
Preserve 
Private 
Property 
Protected 
Public 
RaiseEvent 
ReadOnly 
ReDim 
RemoveHandler 
Resume 
Return 
Select 
Set 
Shadows 
Shared 
Short 
Single 
Static 
Step 
Stop 
String 
Structure 
Sub 
SyncLock 
Then 
Throw 
To 
True 
Try 
TypeOf 
Unicode 
Until 
Variant 
When 
While 
With 
WithEvents 
WriteOnly 
Xor

I also have for Python, Perl, Delphi, CSS, and JavaScript (also some more, too lazy to list them all)
Just tell me if you want them :)
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Correct, PHP syntax hilighting comes with PHP in the form of the highlight_string()

If we wanted to support other language syntaxes, we'd need to mod the forums and use a syntax hilighter like GeSHi

My experience with GeSHi is that it's slow, and that it consumes a lot of power from the server. Try client side syntax highlighters, where if a syntax is relevant to the user, he could click a button in the header of the code and that it converts the text to a syntax. This is the best way to do this, in my opinion.

Or upgrade vBulletin locally, where there are 2 contents of each post. The converted one (full HTML code), and the editable (bb tags) one.
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
My experience with GeSHi is that it's slow, and that it consumes a lot of power from the server.
This is my experience too. We used to use GeSHi for the jass tags, but switched to a hand made solution for performance reasons.

>I believe phyrex modded GeSHi to be faster (yeah, phyrex can do everything, lol) for the Jass highlighting
I "only" managed to make it 3 times faster or so (for the jass tags, probably broke a lot of other languages in the process) and that wasn't enough.

GeSHi is still installed on the server so using it for other languages is possible. The likeliness of me adding is proportional to the activity of the programming forum *hint*. Or bribe Ghan, I hear he has very flexible payment alternatives. :p
 

Romek

Super Moderator
Reaction score
963
I think the problem is that we don't know if it's worth adding the C++ highlighter, rather than we don't know how to add it, or what to add.
 

Samuraid

Advisor
Reaction score
81
Or upgrade vBulletin locally, where there are 2 contents of each post. The converted one (full HTML code), and the editable (bb tags) one.
vBulletin already has a parsed post cache, although I am not aware if it is enabled currently or not. (If it isn't it should be)
 
Reaction score
341
Why not just add something generic that only highlights certain things;

{}, if, while, do, for, strings, floats, integers

That should give at least some highlighting for most languages and is easy to implement.

You could even just make a ripoff of your Jass tags to support that.

Because honestly, this is not a programming heavy forum (aside from Jass).
 

Tru_Power22

You can change this now in User CP.
Reaction score
144
Why not just add something generic that only highlights certain things;

{}, if, while, do, for, strings, floats, integers

That should give at least some highlighting for most languages and is easy to implement.

You could even just make a ripoff of your Jass tags to support that.

Because honestly, this is not a programming heavy forum (aside from Jass).

That's not really true. There are quite a few C++ threads in the programming forum.
 

UndeadDragon

Super Moderator
Reaction score
447
Nothing compared to the Jass threads.

This.

For the amount of work that it would take to add the new tags, it would not be worth it, because of the lack of C++ threads.
 

Vestras

Retired
Reaction score
248
This.

For the amount of work that it would take to add the new tags, it would not be worth it, because of the lack of C++ threads.

But not having C++ syntax highlighting could just aswell be one of the things blocking TH from being more for the programming guys.
 
Reaction score
341
I highly doubt it. TheHelper is always going to be the place for blizzard game support.

The programming forum only has like what? 300 posts?
 

Tru_Power22

You can change this now in User CP.
Reaction score
144
I highly doubt it. TheHelper is always going to be the place for blizzard game support.

The programming forum only has like what? 300 posts?

I'm working on a game and planning to paste the source code in the programming forum (It's pretty small). Syntax Highlighting would be nice.
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,687
Here's what we can predict for the C++ Syntax Highlighting feature.

When Starcraft 2 is out, we will be seeing many threads with the Galaxy language. Since Galaxy is based on C, it is possible (if not, certainly) C/C++ syntax highlighting will be added as a new feature corresponding to the release of the game itself.

For now, I can be sure that it won't be implemented until the end of this year.
 

Vestras

Retired
Reaction score
248
Here's what we can predict for the C++ Syntax Highlighting feature.

When Starcraft 2 is out, we will be seeing many threads with the Galaxy language. Since Galaxy is based on C, it is possible (if not, certainly) C/C++ syntax highlighting will be added as a new feature corresponding to the release of the game itself.

For now, I can be sure that it won't be implemented until the end of this year.

Jass was 'based' on C, too ;)
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top