+ Reply to Thread
Results 1 to 10 of 10

Thread: Block comments/strings

  1. #1
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,683
    Blog Entries
    5

    Default Block comments/strings

    As Divran hinted in the longest thread evar, I am adding block comments/multiline strings to E2. Syntax is:
    Code:
    #[ Ooo, block comments
    The E2 can't see this text, bwahaha! ]#
    
    if (Stuff #[ & BrokenStuff ]#)
    {
        moarStuff()
    }
    
    print("Hey look
    strings can go to the next line.
    BTW, newlines are preserved, so the text is printed in multiple lines.
    You can stop this by placing a backslash \
    at the end of the line.")
    I also added an escape to allow adding characters by their decimal equivalent, effectively running string.char on them.
    Code:
    Test = "\d120" # Test = "x"
    I'll be releasing them when I completely bug test them, and when Divran gives me his highlighting code.

    A few things to note:
    1. Preprocessor statements (#ifdef, ect.), will not be executed if inside a block comment.
    2. For the \d### and \h## syntax, numbers less than 32 or greater than 255 will be ignored, and the statement will be replaced with ""
    3. You can't do:
    Code:
    Test = "\d"+Number
    Use toChar.

    ToDo:
    • Block comments break column numbers when errors occur. Done!
    • Test \d### with wierd numbers. Now has same restrictions as the toChar function
    • Bug Divran to give me the code to the highlighter. Done!
    • Add \h## for adding characters based on hexadecimal representation.
    • Clean up code in the preprocessor (I effectively rewrote the whole process of removing comments.)
    • Commit.
    Last edited by Colonel Thirty Two; 08-27-2010 at 06:34 PM.

  2. #2
    Wire Sofaking Grocel's Avatar
    Join Date
    Mar 2008
    Location
    Germany, NRW, Remscheid
    Posts
    751

    Default Re: Block comments/strings

    Would be nice to see it in the svn when it's ready.
    Quote Originally Posted by Wizard of Ass View Post
    The secret phrase in gmod is: Rusty bullet hole
    Im a molecule!

  3. #3
    Wiremod Helper Donkie's Avatar
    Join Date
    May 2008
    Location
    Sweden
    Posts
    1,660

    Default Re: Block comments/strings

    Why hasen't this been made before? :P

    It's quite cool, lots of these things that people saw impossible, Initrid comes and makes it all
    Get out. Seriously, do it.

  4. #4
    Ursus maritimus Drunkie's Avatar
    Join Date
    Feb 2009
    Location
    Canada
    Posts
    5,662
    Blog Entries
    1

    Default Re: Block comments/strings

    Why are you remaking it if Divran already made it? Or did his version not work completely. Anyways, yeah this could be useful, good work.

    Quote Originally Posted by Divran View Post
    And now we wait for col32 to do his part
    Edit: Nvm just read this.

  5. #5
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,683
    Blog Entries
    5

    Default Re: Block comments/strings

    He only implemented highlighting for it in the editor; this actually does the work of removing the text.

  6. #6
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,683
    Blog Entries
    5

    Default Re: Block comments/strings

    So, I managed to get everything working!..... Except preprocessor commands (#ifdef, ect.). Now I gotta rewrite most of it... =/

  7. #7
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: Block comments/strings

    Pics

    Block comment example:


    What happened if you put the starting #[ inside a string (this was before I added multiline strings)


    Multiline string (& more block comment) examples
    Last edited by Divran; 09-01-2010 at 04:18 AM.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  8. #8
    Wire Sofaking Ehmmett's Avatar
    Join Date
    Sep 2009
    Posts
    595

    Default Re: Block comments/strings

    I was thinking about suggesting this.

  9. #9
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: Block comments/strings

    So how's it going, col32?
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  10. #10
    Wire Sofaking emspike's Avatar
    Join Date
    Feb 2008
    Posts
    911

    Default Re: Block comments/strings

    Quote Originally Posted by initrd.gz View Post
    So, I managed to get everything working!..... Except preprocessor commands (#ifdef, ect.). Now I gotta rewrite most of it... =/
    Cuz it was originally written to process line-by-line :/

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots