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

PHP closing tag inside commented out code stops highlighting

Expand Messages
  • Viper007Bond
    This code breaks EditPlus highlighting: This test is still a part of the comment and should continue being
    Message 1 of 11 , Mar 30, 2010
    • 0 Attachment
      This code breaks EditPlus' highlighting:


      <?php
      /*

      Example:
      <?php echo 'Hello world!'; ?>

      This test is still a part of the comment and should continue being green (the comment color). However it shows up as black or whatnot (normal text).

      */
      ?>


      Is there anything that can be done to fix this?
    • t_cosmas
      Inserting a space between the ? and works to stop EP from recognizing the ? as the end of the PHP statement. I wonder if the PHP processor would also
      Message 2 of 11 , Apr 1, 2010
      • 0 Attachment
        Inserting a space between the "?" and ">" works to stop EP from recognizing the ?> as the end of the PHP statement. I wonder if the PHP processor would also stop at the ?> in the Example instead of seeing it as a part of a comment??

        === Rewritten Code ===

        <?php
        /*

        Example:
        <?php echo 'Hello world!'; ? > <= Added space prevents premature comment end!

        This test is still a part of the comment and should continue being green (the comment color). However it shows up as black or whatnot (normal text).

        */
        ?>

        === End Code ===
        --- In editplus@yahoogroups.com, "Viper007Bond" <yahoo@...> wrote:
        >
        > This code breaks EditPlus' highlighting:
        >
        >
        > <?php
        > /*
        >
        > Example:
        > <?php echo 'Hello world!'; ?>
        >
        > This test is still a part of the comment and should continue being green (the comment color). However it shows up as black or whatnot (normal text).
        >
        > */
        > ?>
        >
        >
        > Is there anything that can be done to fix this?
        >
      • Bronius Motekaitis
        Has anyone confirmed that this is valid php syntax? That php itself will put precedence to /* block comments */ over
        Message 3 of 11 , Apr 1, 2010
        • 0 Attachment
          Has anyone confirmed that this is valid php syntax? That php itself will
          put precedence to /* block comments */ over <?php tags?

          On Thu, Apr 1, 2010 at 10:58 AM, t_cosmas <t_cosmas@...> wrote:

          >
          >
          >
          >
          > Inserting a space between the "?" and ">" works to stop EP from recognizing
          > the ?> as the end of the PHP statement. I wonder if the PHP processor would
          > also stop at the ?> in the Example instead of seeing it as a part of a
          > comment??
          >
          > === Rewritten Code ===
          >
          > <?php
          > /*
          >
          > Example:
          > <?php echo 'Hello world!'; ? > <= Added space prevents premature comment
          > end!
          >
          >
          > This test is still a part of the comment and should continue being green
          > (the comment color). However it shows up as black or whatnot (normal text).
          >
          > */
          > ?>
          >
          > === End Code ===
          >
          > --- In editplus@yahoogroups.com <editplus%40yahoogroups.com>,
          > "Viper007Bond" <yahoo@...> wrote:
          > >
          > > This code breaks EditPlus' highlighting:
          > >
          > >
          > > <?php
          > > /*
          > >
          > > Example:
          > > <?php echo 'Hello world!'; ?>
          > >
          > > This test is still a part of the comment and should continue being green
          > (the comment color). However it shows up as black or whatnot (normal text).
          > >
          > > */
          > > ?>
          > >
          > >
          > > Is there anything that can be done to fix this?
          > >
          >
          >
          >



          --
          http://www.bcswebstudio.com
          kiosk | web | drupal development


          [Non-text portions of this message have been removed]
        • DZ-Jay
          ... The problem is that EditPlus does not properly handle nested comments, or in your example, nested script tags. It is the first ? that breaks it out
          Message 4 of 11 , Apr 1, 2010
          • 0 Attachment
            Viper007Bond wrote:
            >
            >
            > This code breaks EditPlus' highlighting:

            The problem is that EditPlus does not properly handle nested comments,
            or in your example, nested script tags. It is the first "?>" that
            breaks it out from the "script" mode and turns the rest of the text into
            "regular" content.

            dZ.
          • Daniel Gibby
            As far as the PHP parser is concerned, it is fine syntax to put a comment around as much PHP and other mixed code as you want. If it is any consolation, I
            Message 5 of 11 , Apr 1, 2010
            • 0 Attachment
              As far as the PHP parser is concerned, it is fine syntax to put a comment
              around as much PHP and other mixed code as you want.

              If it is any consolation, I haven't seen other editors parse it correctly
              all the time.

              Daniel

              On Thu, Apr 1, 2010 at 10:24 AM, DZ-Jay <dz@...> wrote:

              >
              >
              > Viper007Bond wrote:
              > >
              > >
              > > This code breaks EditPlus' highlighting:
              >
              > The problem is that EditPlus does not properly handle nested comments,
              > or in your example, nested script tags. It is the first "?>" that
              > breaks it out from the "script" mode and turns the rest of the text into
              > "regular" content.
              >
              > dZ.
              >
              >
              >


              [Non-text portions of this message have been removed]
            • DZ-Jay
              ... I thought that the PHP pre-processor parses the out the script blocks from the code, and then sends that to the parser. If this is the case, then the
              Message 6 of 11 , Apr 1, 2010
              • 0 Attachment
                Daniel Gibby wrote:
                > As far as the PHP parser is concerned, it is fine syntax to put a comment
                > around as much PHP and other mixed code as you want.
                >

                I thought that the PHP pre-processor parses the out the script blocks
                from the code, and then sends that to the parser. If this is the case,
                then the comment encasing the inner "<? ?>" would be ignored by the
                pre-processor.

                dZ.
              • Daniel Gibby
                All I know is that it works. Whether it is a pre-parser or a parser is potatoe or potahtoe to me. With the following, you d have no output, that s all I
                Message 7 of 11 , Apr 1, 2010
                • 0 Attachment
                  All I know is that it works. Whether it is a pre-parser or a parser is
                  potatoe or potahtoe to me.

                  With the following, you'd have no output, that's all I remember. Whether or
                  not the call to something_maybe_or_not.php gets parsed and included and then
                  ignored isn't something I've tested. But I have seen it ignored at least.

                  <?php
                  /*
                  bunchof stuff
                  ?>other stuff
                  <?php // more stuff
                  include('something_maybe _or_not.php');
                  ?> even more
                  <?php
                  */
                  ?>


                  On Thu, Apr 1, 2010 at 11:03 AM, DZ-Jay <dz@...> wrote:

                  >
                  >
                  > Daniel Gibby wrote:
                  > > As far as the PHP parser is concerned, it is fine syntax to put a comment
                  > > around as much PHP and other mixed code as you want.
                  > >
                  >
                  > I thought that the PHP pre-processor parses the out the script blocks
                  > from the code, and then sends that to the parser. If this is the case,
                  > then the comment encasing the inner "<? ?>" would be ignored by the
                  > pre-processor.
                  >
                  > dZ.
                  >
                  >
                  >


                  [Non-text portions of this message have been removed]
                • DZ-Jay
                  ... That code is different than the first one posted, which had nested code blocks. In any case, it is irrelevant because, as I said before, EditPlus does not
                  Message 8 of 11 , Apr 1, 2010
                  • 0 Attachment
                    Daniel Gibby wrote:
                    > All I know is that it works. Whether it is a pre-parser or a parser is
                    > potatoe or potahtoe to me.
                    >
                    > With the following, you'd have no output, that's all I remember. Whether or
                    > not the call to something_maybe_or_not.php gets parsed and included and then
                    > ignored isn't something I've tested. But I have seen it ignored at least.
                    >
                    > <?php
                    > /*
                    > bunchof stuff
                    > ?>other stuff
                    > <?php // more stuff
                    > include('something_maybe _or_not.php');
                    > ?> even more
                    > <?php
                    > */
                    > ?>
                    >

                    That code is different than the first one posted, which had nested code
                    blocks.

                    In any case, it is irrelevant because, as I said before, EditPlus does
                    not handle nested comments or script blocks. It is indeed a limitation
                    of the application, but it has been like that forever.

                    I suggest you send a bug report or feature request to Sangil Kim.

                    dZ.
                  • Daniel Gibby
                    ... I m guessing that the this example is actually what the original poster meant, he just left out some of the closing PHP tags. There is a PHP block nested
                    Message 9 of 11 , Apr 1, 2010
                    • 0 Attachment
                      On Thu, Apr 1, 2010 at 12:21 PM, DZ-Jay <dz@...> wrote:

                      > Daniel Gibby wrote:
                      > >
                      > > <?php
                      > > /*
                      > > bunchof stuff
                      > > ?>other stuff
                      > > <?php // more stuff
                      > > include('something_maybe _or_not.php');
                      > > ?> even more
                      > > <?php
                      > > */
                      > > ?>
                      > >
                      >
                      > That code is different than the first one posted, which had nested code
                      > blocks.
                      >
                      > In any case, it is irrelevant because, as I said before, EditPlus does
                      > not handle nested comments or script blocks. It is indeed a limitation
                      > of the application, but it has been like that forever.
                      >
                      > I suggest you send a bug report or feature request to Sangil Kim.
                      >
                      > dZ.
                      >

                      I'm guessing that the this example is actually what the original poster
                      meant, he just left out some of the closing PHP tags.

                      There is a PHP block nested within the comment in either case, it is just
                      that one would be valid PHP syntax if you took away the comment and the
                      other wouldn't.

                      I think PHP handles either one the same way though. It just ignores
                      everything until it finds a closing */ within some PHP block somewhere.
                      As far as EditPlus handling it, I agree, seems like a feature request to
                      me...

                      Daniel


                      [Non-text portions of this message have been removed]
                    • Toft Stade
                      seems like a feature request to me... Seems like abug to me but as mentioned earlier it s been like this forever. Happens with javascript, asp and other
                      Message 10 of 11 , Apr 1, 2010
                      • 0 Attachment
                        "seems like a feature request to
                        me..."

                        Seems like abug to me but as mentioned earlier it's been like this
                        forever. Happens with javascript, asp and other languages too.
                        I usually just ignore it or put in another fake comment to fix
                        highlighting.

                        On 1 apr 2010, at 20.27, Daniel Gibby <daniel.gibby@...> wrote:

                        > seems like a feature request to
                        > me...


                        [Non-text portions of this message have been removed]
                      • DZ-Jay
                        ... To be sure, it is a bug: EditPlus does not handle nested structures which are valid within their own language definitions. dZ.
                        Message 11 of 11 , Apr 1, 2010
                        • 0 Attachment
                          Toft Stade wrote:
                          >
                          >
                          > "seems like a feature request to
                          > me..."
                          >
                          > Seems like abug to me but as mentioned earlier it's been like this
                          > forever. Happens with javascript, asp and other languages too.
                          > I usually just ignore it or put in another fake comment to fix
                          > highlighting.

                          To be sure, it is a bug: EditPlus does not handle nested structures
                          which are valid within their own language definitions.

                          dZ.
                        Your message has been successfully submitted and would be delivered to recipients shortly.