PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Tools and Utilities » PhpDocumentor » Bug #6457

Single-line DocBlocks cause gaps in syntax highlighting

Details

Submitted2006-01-10 20:26 UTC
Fromj dot o dot vik at bio dot uio dot no
StatusDuplicate
PackagePhpDocumentor
PHP Version4.4.1
OSWindows XP Pro SP2
Roadmaps(Not assigned)

Comments

[2006-01-10 20:26 UTC] j dot o dot vik at bio dot uio dot no

Description:
------------
Single-line DocBlocks /** like this */ are widely used in many PEAR packages, including PEAR, DB, and many others. However, the phpDocumentor syntax highlighting makes silent errors in these cases, omitting some source code following the single-line DocBlock.

Actually, single-line DocBlocks would indeed be a convenient feature. The manual does not mention them, though, so I guess such DocBlocks should be considered an error. However,
I would prefer that the error be reported rather than silently leaving the highlighted source code incomplete.

My novice attempt at a regexp for completing DocBlocks from single-line versions follows at the end of the test script.

Test script:
---------------
<?php
/**
* Single-line DocBlocks cause gaps in syntax highlighting
* @filesource
* @package onelinedocblock
*/
/** One-line DocBlock: parsed, but eats the next "define" */
define('A',0);
/**
* This is a full DocBlock and works as it should
*/
define('B',0);
// Workaround to ensure full DocBlocks: Regexp-replace
// "^( *)/\*\* (.*) \*/(\s*)$"
// (whitespace, begin comment, text, end comment) with
// "\1/**\r\n\1 * \2\r\n\1 */"
?>

Expected result:
----------------
Lines 7-12 of syntax-highlighted source code should read:
/** One-line DocBlock: parsed, but eats the next "define" */
define('A',0);
/**
* This is a full DocBlock and works as it should
*/
define('B',0);

Actual result:
--------------
Missing parts in lines 7-12 of syntax-highlighted source:
/** One-line DocBlock: parsed, but eats the next "define" */
('A',0);
/**
* This is a full DocBlock and works as it should
*/
define('B',0);

[2006-01-13 08:15 UTC] j dot o dot vik at bio dot uio dot no

Sorry, I forgot: I'm running WAMP5 1.6.0 (www.wampserver.com) with the PHP4 add-on (PHP4.1.1), and phpDocumentor-1.3.0RC5, on Windows XP Pro SP2.