Loading ...
Sorry, an error occurred while loading the content.

Custom syntax for PHP

Expand Messages
  • Marc Leveille
    Does anyone know if you can define multiple values for #SCRIPT_BEGIN and #SCRIPT_END in the syntax files? I use Here Documents syntax a lot in my PHP scripts,
    Message 1 of 2 , Aug 3, 2004
    • 0 Attachment
      Does anyone know if you can define multiple values for
      #SCRIPT_BEGIN and #SCRIPT_END in the syntax files?
      I use Here Documents syntax a lot in my PHP scripts, and it
      screws up the syntax highlighting something awful.

      For example, assuming a regex is out of the question, I'd
      like to define #SCRIPT_END to "<<<" and #SCRIPT_BEGIN
      to "//>>>", or maybe also "EOF", so I can write:

      echo <<<EOF
      Hello!
      EOF;
      //>>>

      Now that I've gotten used to using proper syntax in my
      PHP files, EditPlus has been excellent in all other respects. :)

      -- Marc Leveille
    • Justin Watt
      based on the php reference for heredoc: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc the heredoc syntax only
      Message 2 of 2 , Aug 3, 2004
      • 0 Attachment
        based on the php reference for heredoc:
        http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

        the heredoc syntax only requires the following:

        echo <<<EOF
        Hello!
        EOF;

        thanks to the following:

        http://www.machak.com/editplus/viewtopic.php?t=33

        i discovered you can take advantage of unused "block comment 2" to
        accomplish this. add the following to your php.stx file:

        #COMMENTON2=<<<EOF
        #COMMENTOFF2=EOF;

        realize this does not allow for variable heredoc identifiers. the php
        script will validate them of course, but editplus will only highlight
        using the identifier you put in your stx file (EOF above). alternatively
        the following should work:

        #COMMENTON2=<<<
        #COMMENTOFF2=;

        if you don't expect to include any semi-colons in your string.

        i've added this solution to the faq i started last month:
        http://www.unc.edu/~jwatt/2004/07/editplus-customizations-faq.html

        Justin Watt


        On Tue, 3 Aug 2004, Marc Leveille wrote:

        > Does anyone know if you can define multiple values for
        > #SCRIPT_BEGIN and #SCRIPT_END in the syntax files?
        > I use Here Documents syntax a lot in my PHP scripts, and it
        > screws up the syntax highlighting something awful.
        >
        > For example, assuming a regex is out of the question, I'd
        > like to define #SCRIPT_END to "<<<" and #SCRIPT_BEGIN
        > to "//>>>", or maybe also "EOF", so I can write:
        >
        > echo <<<EOF
        > Hello!
        > EOF;
        > //>>>
        >
        > Now that I've gotten used to using proper syntax in my
        > PHP files, EditPlus has been excellent in all other respects. :)
        >
        > -- Marc Leveille
        >
        >
        >
        >
        > http://www.editplus.com
        > http://groups.yahoo.com/group/editplus
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.