No announcement yet.

Syntax Hilighting

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    For C++, I use Visual Studio's generic dark settings, but for qc, I usually use Code::Blocks's dark settings like so:

    Last edited by Zop; 12-11-2016, 08:51 PM.


    • #17
      I like everything about that except the red and fuschia.
      Last edited by MadGypsy; 12-11-2016, 09:38 PM.


      • #18
        Yeah, it is a bit crazy... and why did my img tag not work? I can't seem to figure these dang internets.


        • #19
          @why does my img not work

          for whatever reason you omitted the file extension (.png). Simply edit your post and include the file extension and it will work. The easiest way to work with imgur is:

          Edit...wait Imma make this funny and do it like an AOL help center

          1) Please upload your image to imgur. You can do this by dragging and dropping or pasting your image. If you do not know how to do this please file another ticket and an AOL representative will contact you shortly regarding your issue.

          2) When your image is uploaded please hover it and select the "get share links" widget. A pop-up will appear.

          3) Please hover the BBCode section and copy the code to your clipboard. If you do not know how to do this please file another ticket and an AOL representative will contact you shortly regarding your issue.

          4) Please navigate to the post input box of whatever site that you would like to share the image on and paste the code. If you do not know how to do this please file another ticket and an AOL representative will contact you shortly regarding your issue.

          Thank you for using AOL.

          I remember back in the day I used to file tickets with AOL regarding every damn problem my computer would have. Mostly windows ones. I have to give it to them though, they always answered my questions. One ridiculous one I remember was contacting them about how to set a program as a default for a specific file type. They answered that shit, too.
          Last edited by MadGypsy; 12-11-2016, 05:44 PM.


          • #20
            Thanks, AOL. You fixed all my problems.


            • #21
              You are welcome, valued customer.

              ~deleted my clone of your image.


              • #22
                I decided to build my own editor. I actually have a need for this due to a different project but, I figured I would make it versatile while I'm at it.

                Dark Venom Theme

                It currently supports syntax for QC, C(any), PHP, AS3, JavaScript, VBScript, Haxe, JScript, CSS, Java...pretty much any language I program in plus a couple of C's that I don't...and quite possibly even many languages I have never even heard of. The above script isn't supposed to do anything it's just a syntax test.

                Current Features

                1) tabs and close blocks are typed for you and the caret is properly positioned accordingly
                2) smart tab nesting keeps your code inline (whether you like it or not)
                3) cntrl+d to duplicate lines
                4) no need to choose languages. everything is homogenized with super clever regex statements.
                5) escape quotes don't break strings
                6) numbers are supported as int, uint, float, hex (0x000000), hash (#FFFFFF)
                7) any jacked up way you can imagine to define a type is recognized

                plenty of keywords and reserved words are supported which are not illustrated

                class, template, define, using...more, more, more

                There is still a lot to do but, I did all of this in 9 or so hours yesterday.
                Last edited by MadGypsy; 12-22-2016, 02:50 PM.


                • #23
                  super aggressive contextual highlighting

                  IS vs. AS

                  To my knowledge, no editor has contextual highlighting features. And the reason is probably really simple ~ it's hard as fuck to make stuff like this possible while ALSO not being specific in the regex. My regex DOES NOT bother to describe every possible scenario. I do this in a much more clever way.
                  Last edited by MadGypsy; 12-22-2016, 05:58 PM.


                  • #24
                    nice, but on a side note, that red will drive you nuts after a week.


                    • #25
                      @red - maybe but, it doesn't matter cause, I'm about 5 minutes from having the entire themer externalized. Personally, I like my theme more than any theme I have ever had. I think it's sharp and easy on the eyes. I'm not saying that cause I made it. I am more critical of me than I am of anyone else here. I think I just got lucky and did a pretty good job.

                      The syntax engine is only 8 lines of regex. I intend to externalize that and the format objects. I'm almost done with both. Then I'm going to take a step back and put all of it in an array so the syntax engine and the format objects can be extended. In a way, it's like I just created a textfield, a few kb shortcuts and a format applier cause the externalization of the syntax engine and format objects will allow someone to brand/retheme this thing inside-out and upside down.

                      The long strings above the editor are the whole shebang for the syntax engine. That's practically nothing considering this thing highlights like 8 languages (at the very least) and even has contextual highlighting. I know there are some keywords and reserved words missing. That's a nothing. All I have to do is add them to the list, and I will.

                      I added a new feature.

                      it used to be that typing * after / would tab out, line break. properly place the caret and close a multiline comment for you. It still does that but if you hold CNTRL while typing the first asterisk it makes it an /* inline multiline comment */...same thing for typing an open curly bracket. I made all of this in flash* cause it's dead.

                      *technically haxe - I could easily transpile this to whatever
                      Last edited by MadGypsy; 12-22-2016, 09:06 PM.


                      • #26

                        auto generated header for new files*
                        recognized metadada

                        author and copy will be based on a certificate form that allows you to fill in fields that get injected into the proper spot upon new file creation
                        Last edited by MadGypsy; 12-22-2016, 10:56 PM.


                        • #27

                          I externalized the entire theme/regex engine system and even went as far as to externalize the properties for the editor textbox as well. There are a hell of a lot more possibilities than the ones listed here (right side code frame).

                          I don't know if anyone realized this but, this is about a hell of a lot more than making pretty code text. If I can pinpoint things to color them (double especially contextually) I can parse all this shit down to a compiled language. Considering I am covering 8 or more languages (at least in a core sense) that means I can unify all of this down to one thing without forcing people to type in or learn a specific language. It's like opposite haxe. Haxe transpiles to a target language and then compiles. I (am attempting to) take any common scripting language and compile it down to a byte object. Much like reading a progs.dat, the bytes would tell an engine what to do. The cool thing is, the engine could be written in any language and technically I just need to write it in Haxe and compile it to a number of languages. By engine, I do not necessarily mean a 3d one although of course I would use this for that. I have a lot to do.

                          I'm utilizing a lot of API's that I created. One in particular is my FrontEnd API. My FrontEnd API allows JSON to instantiate common elements, like scrollbars, buttons, textboxes, etc...In the case of the theme JSON, it's basically just looping the hell out of FrontEnd in order to create all the formats that are necessary to style the text. The goal is to take everything I said in the upper paragraph and bounce FrontEnd off of it instead of JSON. A whole bunch of the groundwork is already laid for this stuff. I have code coming out of my ears. When I unify all roughly similar languages down to one byteobject this is going to be a big ass deal. If you know a lot of languages you could technically just make shit up and it should work.


                          int someInt = 10
                          var someInt:Int = 10
                          var someInt = 10
                          $someInt = 10

                          My compiler isn't going to give a fuck how you do it. In cases where the type isn't specified, I'll just infer it. All of the above is going to become the exact same thing.

                          for shitz and giggles below are the actual possibilities of just format and textfield alone (we haven't even touched the like 20 other UI things I made). Sorry pics are all double screen. I don't have time or patience to edit that shit down right now. To get an idea of the size of this look at the project tree. If I fully expanded that shit it would be halfway down the block.
                          Last edited by MadGypsy; 12-25-2016, 08:48 PM.


                          • #28

                            I made some serious advancements

                            1) For whatever reason the built-in JSON parser I'm using doesn't support comments (stupid) so I made that bitch support comments...all of them haxe and legacy. I had a serious burp though cause, even after I made it support comments it was throwing errors. It took me about 10 minutes to realize that I had one regex which fit the bill for the tail end of a comment :/

                            Now that it supports multi-line comments it's easier to keep track of this stuff. As you can see everything is labeled to where engine "references" format and vice-versa.

                            2) It used to be that if even one format used (ex) bold:true then all other formats had to have bold:false (to turn it off). That isn't necessary anymore. All formats are "null-state" defaulted so, that shit is automatic now. Same thing goes for a bunch of the textfield properties. No more border:false...etc. It's off by default unless you turn it on.

                            So, to make a new theme goes something like this

                            Leave "engine" the hell alone unless you are in need of parsing some archaic language.
                            Pretty much leave "editor" alone, too, with maybe the exception of changing border or background color. I mean, you can change all of "editor" but, I don't see the need to for most of it.

                            That just leaves "formats"- to make a new theme you have to change a whopping 9 colors and maybe play with bold/italics. I have messed with the themes to a few editors and NONE of them are this simple. It's usually a monster pain in the ass. You can retheme my editor in like 1 minute if you know what colors you want.

                            Now, I am going to rewrite the entire regex engine block to be 100% serious and compatible with all platforms. C++ does not like my regex. That's OK. I don't like it either. Too many look behinds. When I am done with that, I will finally be ready to start parsing this stuff down to a compiled language. I have taken my time on this cause there were some things that confused me. I pretty much have my thoughts in order at this point and I think I'm ready to tackle it....after I nail my regex for syntax hilighting.


                            • #29

                              Unification is pretty hard. I still have a bunch of work to do on this reference.


                              • #30
                                I've been staring at that and thinking. I think I'm going to very slightly change focus. Instead of trying to get all of these languages parsed down to one compiled one, I think I am going to merge these languages and allow a few syntactical exceptions.

                                for instance, all of the c# types are good but it would be even better with vector<T> as array<T>, map<S,T>, void, null, nan and undefined

                                the exceptions could go like this

                                array<int> nVar = new array<int>(x);
                                var nVar:array<int> = new array<int>(x);
                                (both above) nVar = [1,2,3,4,5];

                                int[] nVar = new int[x];
                                nvar = {1,2,3,4,5};

                                That's a lot of exceptions but they all have the same things in common. In declaration, type and name are to the left of the equal sign and everything to the right of the equal sign is completely useless except for the value of x and new. Without new it must be an actual value;

                                Then in assignation they have the same things in common again. The name to the left of the equal sign and encapsulated values that contain no colons and separated by commas to the right of the equals.

                                This means, for declaration
                                split on equal
                                left side
                                get type -> get name -> is Array?
                                right side
                                is new? -> (is Array)? get x : die

                                for assigntion
                                split on equal
                                left side
                                get name
                                right side
                                is CSV? -> colons? -> (csv && !colons)? (isArray)? asArray isObject)? asObject : error;

                                pretty much rendering curly and square brackets completely useless.

                                you could basically write

                                int[] nVar = new x;
                                array<int> nVar = new x;
                                var nVar:array<int> = new x;
                                nVar = 1,2,3,4,5;


                                I thought of something that I find funny. What if arrays were declared by adding the letter s to any type
                                strings nVar = new x;
                                new is really only necessary if you want to make it fixed length. What if you didnt care about that?
                                strings nVar = "an", "array", "of", "strings";
                                hell, you don't even need the quotes. It's already been told to be strings
                                strings nVar = an, array, of, strings;
                                shit, why even bother with the equal sign? separate everything with a tab. Lose the semicolon too and use newline. We don't need the commas either. Just use space. LOL!
                                strings nVar		an array of strings
                                actually we don't even need to tell it to be strings. let the compiler figure it out, Just use s so it knows it's an array
                                s nVar		an array of strings
                                now it makes our variable name look like it's trying too hard. We''l just number our s's
                                s1	an array of strings
                                while we're at it, let's just not program anything at all
                                Last edited by MadGypsy; 12-27-2016, 04:26 AM.