Using PSPad 4.5.4 (2320) on WinXP.

I've noticed a few oddities where PSPad's Code Explorer doesn't correctly
recognize where a function is defined (even after refreshing the Code
Explorer).

I notice this mostly in the HTML Multihilighter, but it also occurs with
straight PHP highlighting.

Example - Conditional function declarations
(http://www.php.net/manual/en/functions.user-defined.php)

PHP allows you to conditionally define a function in the middle of a control
structure (if-then, switch, etc.).  

For example:
cite:
--------------------------------------------------------------------------------
<?php

// Declare myfunc() one way...
if ($foo) function myfunc()
{
// something
}

// ...or another
else function myfunc()
{
// something different
}
myfunc(); // Call myfunc()

?>--------------------------------------------------------------------------------


In the above, the Code Explorer doesn't recognize myfunc() as being declared
because the declarations don't begin with newlines.

By comparison...
cite:
--------------------------------------------------------------------------------
<?php

if ($foo)
{ // Declare myfunc() one way
  function myfunc()
  {
  // something
  }
}
else
{ // Declare myfunc() differently
  function myfunc()
  {
  // something different
  }
}
myfunc(); // Call myfunc()

?>--------------------------------------------------------------------------------


Here, the Code Explorer correctly recognizes and lists myfunc() -- twice in
fact!  If the same function declaration is found more than once the Code
Explorer should group the declarations together like it already does with
variables (e.g., [+] icon, expanding with line numbers of the declarations).

Another semi-related oddity....

cite:
--------------------------------------------------------------------------------
<?php

// Let's output some Javascript for the client-side
echo "<script type='text/javascript'><!--
function myJavaScript()
{
  // Do something in Javascript
}
--></script>";

?>--------------------------------------------------------------------------------


This causes the Code Explorer to list myJavaScript() as a PHP function
declaration -- it's not!  In the PHP sense this is just a string literal, not a
function declaration.  The fact that it contains a Javascript declaration isn't
necessarily important.  (This can actually be useful in some cases, but a bug is
a bug)

-- 
<http://forum.pspad.com/read.php?4,49268,49268>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem